Skip to content

Commit

Permalink
Update exhaustivestruct (#1472)
Browse files Browse the repository at this point in the history
* Update exhaustivestruct

* Add tests
  • Loading branch information
mbilski authored Oct 26, 2020
1 parent f414375 commit 55e35d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/maratori/testpackage v1.0.1
github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // v1.0
github.com/mattn/go-colorable v0.1.8
github.com/mbilski/exhaustivestruct v1.0.1
github.com/mbilski/exhaustivestruct v1.1.0
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-ps v1.0.0
github.com/moricho/tparallel v0.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions test/testdata/exhaustivestruct.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ package testdata
type Test struct {
A string
B int
c bool // ignore private field
D float64
}

var pass = Test{
A: "a",
B: 0,
D: 1.0,
}

var fail = Test{ // ERROR "B is missing in Test"
A: "a",
D: 1.0,
}

var failMultiple = Test{ // ERROR "B, D are missing in Test"
A: "a",
}

0 comments on commit 55e35d2

Please sign in to comment.