Skip to content

Commit

Permalink
feat: handle empty name
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jan 3, 2022
1 parent 9108fa5 commit 7b21925
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ check:
golangci-lint run

build:
go build -v -ldflags "-s -w" -trimpath ./cmd/tagliatelle/
go build -ldflags "-s -w" -trimpath ./cmd/tagliatelle/
3 changes: 1 addition & 2 deletions tagliatelle.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ func analyze(pass *analysis.Pass, config Config, n *ast.StructType, field *ast.F
}

if value == "" {
// skip empty value, it can change in the future
continue
value = fieldName
}

converter, err := getConverter(convName)
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/a/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ type Bur struct {
Name string
Value string `yaml:"Value"` // want `yaml\(camel\): got 'Value' want 'value'`
More string `json:"-"`
Also string `json:",omitempty"`
Also string `json:",omitempty"` // want `json\(camel\): got 'Also' want 'also'`
ReqPerS string `avro:"req_per_s"`
}

0 comments on commit 7b21925

Please sign in to comment.