I am using the new `golang:1.22.0-alpine3.19` Alpine image to build and 
test a Golang 1.22.0 application. The test uses coverage like that `go test 
-v ./... -coverprofile=coverage.out -coverpkg=./internal/... -covermode 
count`. The test command seems to work fine, but the exit status is 1. The 
created coverage.out seems also fine, as I could use go tool cover with it, 
see below.

Golang version: 1.22.0
Container Image: golang:1.22.0-alpine3.19

Reproducer:

main.go:
package main

import (
  "example.com/m/internal"
  "fmt"
)

func main() {
  fmt.Println(internal.Helloer())
}


internal/helloer.go:
package internal

func Helloer() string {
  return "Hello, world!"
}

internal/helloer_test.go:
package internal

import "testing"

func TestHelloer(t *testing.T) {
  want := "Hello, world!"
  got := Helloer()
  t.Errorf("Helloer() = %v, want %v", got, want)
}

go.mod:
module example.com/m

go 1.22

Shell commands for testing:

apk add --no-cache build-base
go test -v ./... -coverprofile=coverage.out -coverpkg=./internal/... 
-covermode count || echo "flaky:$?"
go tool cover -html=coverage.out -o coverage.html
go tool cover -func=coverage.out


Is it a bug or exepected behaviour?



-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9fe031e4-7f3d-4508-b194-bd9074b3dcfcn%40googlegroups.com.

Reply via email to