1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-19 20:57:53 +02:00

fix: no output

In the windows support efforts, accidentally started using testlib in
production code.

`testlib` disables log output on `init`, which was causing the issue.

fixed the usage, and added a panic if `testlib` is used outside of
tests.

closes #5292
This commit is contained in:
Carlos Alexandro Becker 2024-11-18 07:51:43 -03:00
parent 0ec1c2cf2a
commit 700889269f
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"io"
h "net/http"
"os"
"runtime"
"strings"
"github.com/caarlos0/log"
@ -15,7 +16,6 @@ import (
"github.com/goreleaser/goreleaser/v2/internal/extrafiles"
"github.com/goreleaser/goreleaser/v2/internal/pipe"
"github.com/goreleaser/goreleaser/v2/internal/semerrgroup"
"github.com/goreleaser/goreleaser/v2/internal/testlib"
"github.com/goreleaser/goreleaser/v2/internal/tmpl"
"github.com/goreleaser/goreleaser/v2/pkg/config"
"github.com/goreleaser/goreleaser/v2/pkg/context"
@ -336,7 +336,7 @@ func getHTTPClient(upload *config.Upload) (*h.Client, error) {
if upload.TrustedCerts != "" {
pool, err := x509.SystemCertPool()
if err != nil {
if testlib.IsWindows() {
if runtime.GOOS == "windows" {
// on windows ignore errors until golang issues #16736 & #18609 get fixed
pool = x509.NewCertPool()
} else {

View File

@ -2,10 +2,14 @@ package testlib
import (
"io"
"testing"
"github.com/caarlos0/log"
)
func init() {
if !testing.Testing() {
log.Fatal("testlib should not be used in production code!")
}
log.Log = log.New(io.Discard)
}