Skip to content

cmd/go: C source files not allowed when not using cgo or SWIG #73727

Closed
@8188

Description

@8188

Go version

1.24.3

Output of go env in your module/workspace:

set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=1
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=on
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=
set GOCACHE=C:\Users\1008255\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\1008255\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\1008255\AppData\Local\Temp\go-build2628681816=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
go: stripping unprintable or unescapable characters from %"GOMOD"%
set GOMOD=D:\���档\Go\Project\G50������系���\G50\backend\go.mod
go: stripping unprintable or unescapable characters from %"GOMODCACHE"%
set GOMODCACHE=D:\���档\Go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
go: stripping unprintable or unescapable characters from %"GOPATH"%
set GOPATH=D:\���档\Go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=E:\Go
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\1008255\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=E:\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.3
go: stripping unprintable or unescapable characters from %"GOWORK"%
set GOWORK=D:\���档\Go\Project\G50������系���\G50\backend\go.work
set PKG_CONFIG=pkg-config

What did you do?

Three days ago, running go run main.go started reporting the error below. However, everything worked fine before that.
I tried repairing the Go installer, then ran go clean -modcache && go mod tidy, which temporarily fixed it. But after restarting Windows, the error returned. The same issue occurs with both Go 1.21 and 1.24.
Today, I discovered that running go run main.go in VS Code's terminal works correctly. This makes me suspect it's a bug.

What did you see happen?

package command-line-arguments
imports github.com/gofiber/fiber/v2
imports crypto/tls
imports crypto/internal/boring: C source files not allowed when not using cgo or SWIG: div_test.c
package command-line-arguments
imports github.com/gofiber/fiber/v2
imports crypto/tls
imports crypto/internal/hpke
imports golang.org/x/crypto/chacha20poly1305
imports golang.org/x/sys/cpu: C source files not allowed when not using cgo or SWIG: cpu_gccgo_x86.c

What did you expect to see?

See nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions