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

cmd/go: Issue with net/http with go modules on linux #30920

Closed
talgat-ruby opened this issue Mar 19, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@talgat-ruby
Copy link

commented Mar 19, 2019

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

$ go version
go version go1.12 linux/amd64

Does this issue reproduce with the latest release?

I have the latest 1.12

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

Linux Mint 19.1

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/toshiba/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/toshiba/Documents/workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/home/toshiba/Documents/workspace/go_projects/active-sport-server/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build887106064=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Tried to run GO111MODULE=on CGO_ENABLED=0 go build outside of $GOPATH in order to try go modules. But there seems some problem with net/http package.

$ cat main.go 
package main

import "net/http"

func main() {
	http.ListenAndServe(":8080", nil)
}

What did you expect to see?

correctly built

What did you see instead?

$ GO111MODULE=on CGO_ENABLED=0 go build
# crypto/rc4
/usr/local/go/src/crypto/rc4/rc4_asm.go:15:18: (*Cipher).XORKeyStream redeclared in this block
	previous declaration at /usr/local/go/src/crypto/rc4/rc4.go:61:6
# bytes
/usr/local/go/src/bytes/bytes_decl.go:10:6: IndexByte redeclared in this block
	previous declaration at /usr/local/go/src/bytes/bytes.go:101:34
/usr/local/go/src/bytes/bytes_decl.go:17:6: Equal redeclared in this block
	previous declaration at /usr/local/go/src/bytes/bytes.go:18:25
/usr/local/go/src/bytes/bytes_decl.go:24:6: Compare redeclared in this block
	previous declaration at /usr/local/go/src/bytes/bytes.go:37:27
# crypto/cipher
/usr/local/go/src/crypto/cipher/xor_amd64.go:9:6: xorBytes redeclared in this block
	previous declaration at /usr/local/go/src/crypto/cipher/xor.go:58:33
/usr/local/go/src/crypto/cipher/xor_amd64.go:22:6: xorWords redeclared in this block
	previous declaration at /usr/local/go/src/crypto/cipher/xor.go:83:27
# strings
/usr/local/go/src/strings/strings_decl.go:8:6: IndexByte redeclared in this block
	previous declaration at /usr/local/go/src/strings/strings.go:150:34

@mikioh mikioh changed the title Issue with net/http with go modules on linux cmd/go: Issue with net/http with go modules on linux Mar 19, 2019

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Mar 19, 2019

Fortunately, tip works well with "GO111MODULE=on CGO_ENABLED=0 go build" at $GOROOT/src/net/http.

@acln0

This comment has been minimized.

Copy link
Contributor

commented Mar 19, 2019

I think you have somehow overwritten your previous Go installation with a new one. The assembly implementation of rc4 was removed in 1.12, but you seem to have both.

I suggest wiping the current installation, and reinstalling Go, preferably using the official tarball rather than your OS package manager.

@agnivade

This comment has been minimized.

Copy link
Member

commented Mar 19, 2019

Yes, your installation seems broken. This is not a modules issue. Just try with go build and even that should fail. Please delete your previous installation and do a clean install.

If that does not solve your issue, feel free to reopen. Thanks.

@agnivade agnivade closed this Mar 19, 2019

@talgat-ruby

This comment has been minimized.

Copy link
Author

commented Mar 19, 2019

Thanks the deleting previous installation and reinstalling helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.