File tree Expand file tree Collapse file tree
cmd/go-ctrf-json-reporter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ type commandFlags struct {
3737}
3838
3939// NOTE(fredbi)
40- // Sugggestions (future enhancements):
40+ // Suggestions (future enhancements):
4141//
4242// - outputFile could be provided as an io.Writer: this makes the package easier to test
4343// - outputFile is currently required but could default to stdout
@@ -86,7 +86,7 @@ func execute(cmd *commandContext) error {
8686 extraMap , isMap := report .Results .Extra .(map [string ]any )
8787 if ! isMap {
8888 err = fmt .Errorf ("expected a map, but got %T instead" , report .Results .Extra )
89- return fmt .Errorf ("error writing the report to file : %w" , err )
89+ return fmt .Errorf ("error extracting report results : %w" , err )
9090 }
9191 if _ , ok := extraMap ["buildFail" ]; ok {
9292 buildFailed = true
Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ func TestExecute(t *testing.T) {
3737 t .Run ("should parse go test json data" , func (t * testing.T ) {
3838 fixture , err := os .Open (filepath .Join ("testdata" , "test.json" ))
3939 require .NoError (t , err )
40+ defer func () {
41+ _ = fixture .Close ()
42+ }()
4043
4144 var stdout bytes.Buffer
4245 ctx := freshContext (& stdout , fixture )
@@ -66,6 +69,9 @@ func TestExecute(t *testing.T) {
6669 t .Run ("should parse go test json data" , func (t * testing.T ) {
6770 fixture , err := os .Open (filepath .Join ("testdata" , "test.json" ))
6871 require .NoError (t , err )
72+ defer func () {
73+ _ = fixture .Close ()
74+ }()
6975 output := filepath .Join (tempDir , "test-report-app.json" )
7076
7177 ctx := freshContext (nil , fixture )
@@ -103,6 +109,9 @@ func TestExecute(t *testing.T) {
103109 t .Run ("should parse go test json data" , func (t * testing.T ) {
104110 fixture , err := os .Open (filepath .Join ("testdata" , "test.json" ))
105111 require .NoError (t , err )
112+ defer func () {
113+ _ = fixture .Close ()
114+ }()
106115 output := filepath .Join (tempDir , "test-report-app.json" )
107116
108117 ctx := freshContext (nil , fixture )
You can’t perform that action at this time.
0 commit comments