cmd/go: build and list do not accept absolute path

44 views
Skip to first unread message

孟帅

unread,
Jun 17, 2024, 1:30:00 PM (13 days ago) Jun 17
to golang-nuts
<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.22.4 linux/arm64
</pre>

### Does this issue reproduce with the latest release?
yes

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE='auto'
GOARCH='arm64'
GOBIN=''
GOCACHE='/home/Admin/.cache/go-build'
GOENV='/home/Admin/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/Admin/programs/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/Admin/programs/gopath'
GOPRIVATE=''
GOPROXY='https://goproxy.cn'
GOROOT='/home/Admin/.g/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/Admin/.g/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD=''
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1241080314=/tmp/go-build -gno-record-gcc-switches'
GOROOT/bin/go version: go version go1.22.4 linux/arm64
GOROOT/bin/go tool compile -V: compile version go1.22.4
uname -sr: Linux 5.4.96-arm64-desktop
Distributor ID: Uos
Description: UOS Desktop 20 Pro
Release: 20
Codename: eagle
/lib/aarch64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.28.30-deepin1) stable release version 2.28.
gdb --version: GNU gdb (Uos 8.2.1.1-1+security) 8.2.1
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->

➜  examples tree .
.
├── example1
│   └── test.go
└── example2
    └── test.go

2 directories, 2 files
➜  examples go build /home/Admin/projects/examples/example1
import "/home/Admin/projects/examples/example1": cannot import absolute path

### What did you expect to see?

build success

### What did you see instead?

import "/home/Admin/projects/examples/example1": cannot import absolute path

### other info
Reply all
Reply to author
Forward
0 new messages