Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ jobs:
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: ${{ matrix.go-versions }}
- name: Run go vet
run: go vet ./...
- name: Run yaml-test-suit tests
run: make test-yts
- name: Run go test
run: GO111MODULE=on go test -v -race .
run: go test -vet=off -v -race ./...
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ foo: &a1 bar
- `make lint`
- `make fmt`
- `make tidy`
- `make vet`
- Submit a [Pull Request](https://github.com/yaml/go-yaml/pulls)


Expand Down
11 changes: 2 additions & 9 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ count ?= 1

# Test rules:
test: $(GO-DEPS)
go test$(if $v, -v)
go test$(if $v, -v) -vet=off ./...

test-data: $(YTS-DIR)

Expand All @@ -90,14 +90,7 @@ fmt: $(GOLANGCI-LINT-VERSIONED)
$< fmt ./...

lint: $(GOLANGCI-LINT-VERSIONED)
$< run

fumpt: $(GO)
@go install mvdan.cc/gofumpt@latest
gofumpt -l -w $(GO-FILES)

vet: $(GO)
go vet ./...
$< run ./...

cli: $(CLI-BINARY)

Expand Down
13 changes: 13 additions & 0 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,19 @@ ba?r: a?bc
"ba?r": "a?bc",
},
},

// issue https://github.com/yaml/go-yaml/issues/157
{
`foo: abc
bar: def`,
struct {
F string `yaml:"foo"` // the correct tag, because it has `yaml` prefix
B string `bar` //nolint:govet // the incorrect tag, but supported
}{
F: "abc",
B: "def", // value should be set using whole tag as a name, see issue: <https://github.com/yaml/go-yaml/issues/157>
},
},
}

type M map[string]any
Expand Down
12 changes: 12 additions & 0 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,18 @@ var marshalTests = []struct {
},
"foo:\n bar: a?bc\n",
},

// issue https://github.com/yaml/go-yaml/issues/157
{
struct {
F string `yaml:"foo"` // the correct tag, because it has `yaml` prefix
B string `bar` //nolint:govet // the incorrect tag, but supported
}{
F: "abc",
B: "def", // value should be set using whole tag as a name, see issue: <https://github.com/yaml/go-yaml/issues/157>
},
"foo: abc\nbar: def\n",
},
}

func TestMarshal(t *testing.T) {
Expand Down
Loading