Skip to content

Commit 5ca4a96

Browse files
committed
wip
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
1 parent 23fa87a commit 5ca4a96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+12457
-237
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
goreleaser-mcp
22
coverage.html
33
coverage.out
4+
.task/
45
# Added by goreleaser init:
56
dist/

Taskfile.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://taskfile.dev
2+
3+
version: "3"
4+
5+
env:
6+
GO111MODULE: on
7+
GOPROXY: https://proxy.golang.org,direct
8+
9+
tasks:
10+
sync:
11+
desc: Sync config
12+
sources:
13+
- ../goreleaser/www/docs/
14+
generates:
15+
- ./pkg/config/
16+
cmds:
17+
- mkdir -p docs
18+
- cp -rf ../goreleaser/www/docs/customization ./docs/
19+
- cp -rf ../goreleaser/www/docs/deprecations.md ./docs/

cmd.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

parse.go renamed to config.go

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,14 @@ import (
44
"reflect"
55
"strings"
66

7-
"github.com/goreleaser/goreleaser-mcp/internal/yaml"
87
"github.com/goreleaser/goreleaser-pro/v2/pkg/config"
98
)
109

11-
// parse reads a goreleaser configuration from a byte slice and returns a config.Project.
12-
func parse(in []byte) (*config.Project, error) {
13-
var out config.Project
14-
if err := yaml.UnmarshalStrict(in, &out); err != nil {
15-
return nil, err
16-
}
17-
return &out, nil
18-
}
19-
2010
// findDeprecated returns a map of deprecated fields that have non-zero values.
2111
// The keys are the composed field names (e.g., 'archives.builds', 'brews').
2212
func findDeprecated(cfg config.Project) map[string]struct{} {
2313
deprecated := make(map[string]struct{})
24-
checkDeprecatedFields(reflect.ValueOf(cfg).Elem(), "", deprecated)
14+
checkDeprecatedFields(reflect.ValueOf(&cfg).Elem(), "", deprecated)
2515
return deprecated
2616
}
2717

@@ -32,46 +22,45 @@ func checkDeprecatedFields(v reflect.Value, prefix string, deprecated map[string
3222
field := v.Field(i)
3323
fieldType := t.Field(i)
3424

35-
// Skip unexported fields
3625
if !field.CanInterface() {
3726
continue
3827
}
3928

40-
// Get the yaml tag name
4129
yamlTag := fieldType.Tag.Get("yaml")
4230
if yamlTag == "" || yamlTag == "-" {
4331
continue
4432
}
45-
// Remove omitempty and other options
33+
4634
yamlName := strings.Split(yamlTag, ",")[0]
4735

48-
// Build the composed name
4936
var composedName string
5037
if prefix == "" {
5138
composedName = yamlName
5239
} else {
5340
composedName = prefix + "." + yamlName
5441
}
5542

56-
// Check if field has "deprecated=true" in jsonschema tag
5743
isDeprecated := strings.Contains(fieldType.Tag.Get("jsonschema"), "deprecated")
5844

59-
// Check if the field is non-zero
6045
if isDeprecated && !isZero(field) {
6146
deprecated[composedName] = struct{}{}
47+
continue
6248
}
6349

64-
// Recursively check nested structs
6550
if field.Kind() == reflect.Struct {
6651
checkDeprecatedFields(field, composedName, deprecated)
67-
} else if field.Kind() == reflect.Slice {
52+
continue
53+
}
54+
if field.Kind() == reflect.Slice {
6855
for j := 0; j < field.Len(); j++ {
6956
elem := field.Index(j)
7057
if elem.Kind() == reflect.Struct {
7158
checkDeprecatedFields(elem, composedName, deprecated)
7259
}
7360
}
74-
} else if field.Kind() == reflect.Pointer && !field.IsNil() {
61+
continue
62+
}
63+
if field.Kind() == reflect.Pointer && !field.IsNil() {
7564
if field.Elem().Kind() == reflect.Struct {
7665
checkDeprecatedFields(field.Elem(), composedName, deprecated)
7766
}

0 commit comments

Comments
 (0)