github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/printers/github_test.go (about) 1 package printers 2 3 import ( 4 "go/token" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 9 "github.com/elek/golangci-lint/pkg/result" 10 ) 11 12 func TestFormatGithubIssue(t *testing.T) { 13 sampleIssue := result.Issue{ 14 FromLinter: "sample-linter", 15 Text: "some issue", 16 Pos: token.Position{ 17 Filename: "path/to/file.go", 18 Offset: 2, 19 Line: 10, 20 Column: 4, 21 }, 22 } 23 require.Equal(t, "::error file=path/to/file.go,line=10,col=4::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue)) 24 25 sampleIssue.Pos.Column = 0 26 require.Equal(t, "::error file=path/to/file.go,line=10::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue)) 27 }