various: add golangci-lint, fix issues (#7905)
This adds an initial and intentionally minimal configuration for golang-ci, fixes the issues reported, and adds a GitHub Action to check new pull requests against this linter configuration. Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I8f38fbc315836a19a094d0d3e986758b9313f163
This commit is contained in:
@@ -134,7 +134,7 @@ func newTestchain(t *testing.T, input string, options ...testchainOpt) *testChai
|
||||
out.recordPos(s.TokenText(), s.Pos())
|
||||
// If the last token was '->', that means
|
||||
// that the next identifier has a child relationship
|
||||
// with the identifier preceeding '->'.
|
||||
// with the identifier preceding '->'.
|
||||
if lastWasChain {
|
||||
out.recordParent(t, s.TokenText(), lastIdent)
|
||||
}
|
||||
@@ -347,16 +347,16 @@ func TestNewTestchain(t *testing.T) {
|
||||
`, optTemplate("test", AUM{MessageKind: AUMNoOp, KeyID: []byte{10}}))
|
||||
|
||||
want := map[string]*testchainNode{
|
||||
"genesis": &testchainNode{Name: "genesis", Uses: []scanner.Position{{Line: 2, Column: 16}}},
|
||||
"B": &testchainNode{
|
||||
"genesis": {Name: "genesis", Uses: []scanner.Position{{Line: 2, Column: 16}}},
|
||||
"B": {
|
||||
Name: "B",
|
||||
Parent: "genesis",
|
||||
Uses: []scanner.Position{{Line: 2, Column: 21}, {Line: 3, Column: 21}, {Line: 4, Column: 21}},
|
||||
},
|
||||
"C": &testchainNode{Name: "C", Parent: "B", Uses: []scanner.Position{{Line: 2, Column: 26}}},
|
||||
"D": &testchainNode{Name: "D", Parent: "B", Uses: []scanner.Position{{Line: 3, Column: 26}}},
|
||||
"E": &testchainNode{Name: "E", Parent: "B", HashSeed: 12, Uses: []scanner.Position{{Line: 4, Column: 26}, {Line: 6, Column: 10}}},
|
||||
"F": &testchainNode{Name: "F", Parent: "E", Template: "test", Uses: []scanner.Position{{Line: 4, Column: 31}, {Line: 7, Column: 10}}},
|
||||
"C": {Name: "C", Parent: "B", Uses: []scanner.Position{{Line: 2, Column: 26}}},
|
||||
"D": {Name: "D", Parent: "B", Uses: []scanner.Position{{Line: 3, Column: 26}}},
|
||||
"E": {Name: "E", Parent: "B", HashSeed: 12, Uses: []scanner.Position{{Line: 4, Column: 26}, {Line: 6, Column: 10}}},
|
||||
"F": {Name: "F", Parent: "E", Template: "test", Uses: []scanner.Position{{Line: 4, Column: 31}, {Line: 7, Column: 10}}},
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(want, c.Nodes, cmpopts.IgnoreFields(scanner.Position{}, "Offset")); diff != "" {
|
||||
|
||||
Reference in New Issue
Block a user