Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import/path: go build -trimpath no trim in root path #69512

Closed
ddatsh opened this issue Sep 18, 2024 · 2 comments
Closed

import/path: go build -trimpath no trim in root path #69512

ddatsh opened this issue Sep 18, 2024 · 2 comments

Comments

@ddatsh
Copy link
Contributor

ddatsh commented Sep 18, 2024

Go version

go version go1.23.1 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\admin\AppData\Local\go-build
set GOENV=C:\Users\admin\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\admin\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\admin\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\admin\.g\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\admin\.g\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.1
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\admin\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=Z:\TEMP\go-build3577254774=/tmp/go-build -gno-record-gcc-switches

What did you do?

package main

func f(x int) int {
	return 1 / x
}
func main() {
	f(0)
}

xx.go in root path like z:/
go build -trimpath xx.go

What did you see happen?

panic: runtime error: integer divide by zero

goroutine 1 [running]:
main.f(...)
        z:/xx.go:4
main.main()
        z:/xx.go:7 +0xa

What did you expect to see?

panic: runtime error: integer divide by zero

goroutine 1 [running]:
main.f(...)
        ./xx.go:4
main.main()
       ./xx.go:7 +0xa
@seankhliao
Copy link
Member

you need to be in a module for trimpath to make sense.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants