Skip to content

Commit 7b21925

Browse files
committed
feat: handle empty name
1 parent 9108fa5 commit 7b21925

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ check:
1212
golangci-lint run
1313

1414
build:
15-
go build -v -ldflags "-s -w" -trimpath ./cmd/tagliatelle/
15+
go build -ldflags "-s -w" -trimpath ./cmd/tagliatelle/

tagliatelle.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ func analyze(pass *analysis.Pass, config Config, n *ast.StructType, field *ast.F
9797
}
9898

9999
if value == "" {
100-
// skip empty value, it can change in the future
101-
continue
100+
value = fieldName
102101
}
103102

104103
converter, err := getConverter(convName)

testdata/src/a/sample.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ type Bur struct {
2525
Name string
2626
Value string `yaml:"Value"` // want `yaml\(camel\): got 'Value' want 'value'`
2727
More string `json:"-"`
28-
Also string `json:",omitempty"`
28+
Also string `json:",omitempty"` // want `json\(camel\): got 'Also' want 'also'`
2929
ReqPerS string `avro:"req_per_s"`
3030
}

0 commit comments

Comments
 (0)