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

go mod does not work correctly #31025

Closed
jacking212 opened this issue Mar 25, 2019 · 2 comments
Closed

go mod does not work correctly #31025

jacking212 opened this issue Mar 25, 2019 · 2 comments

Comments

@jacking212
Copy link
Contributor

jacking212 commented Mar 25, 2019

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

$ go version
go version go1.12.1 linux/amd64

Does this issue reproduce with the latest release?

i am using the latest version download from golang.org/dl

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jay/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/lib/go/gopath"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/lib/go/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/lib/go/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jay/workspace/goproject/modtest/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 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build438757086=/tmp/go-build -gno-record-gcc-switches"

What did you do?

i created a test project using go mod, but it got a mistakes when building.
the detail as follows:
main.go

package main
import(
    _ "golang.org/x/text"    
    _ "golang.org/x/crypto"    
    _ "golang.org/x/net"  
    _ "golang.org/x/sys"   
    "fmt"
)
// i had tried delete the imports, and found that only 'golang.org/x/text' could work correctly.

func main(){
    fmt.Println("x")
}

go.mod

module modtest

go 1.12

require (
        golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576
        golang.org/x/net v0.0.0-20190324223953-e3b2ff56ed87
        golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc
        golang.org/x/text v0.3.0
)
// the version of package was auto generated.   i set all latest before building the program.

What did you expect to see?

if it run correctly,it should print 'x'

What did you see instead?

[jay@jay modtest]$ go run main.go
go: finding golang.org/x/net latest
go: finding golang.org/x/crypto latest
build command-line-arguments: cannot load golang.org/x/crypto: cannot find module providing package golang.org/x/crypto
@jacking212
Copy link
Contributor Author

the gopath files :

[jay@jay gopath]$ tree -L 5  
.
`-- pkg
    `-- mod
        |-- cache
        |   |-- download
        |   |   |-- github.com
        |   |   `-- golang.org
        |   |-- lock
        |   `-- vcs
        |       |-- 3d9b894478eea73fae540a3c6900133702ad88e0dbb703558d5c10d87962b8f1
        |       |-- 3d9b894478eea73fae540a3c6900133702ad88e0dbb703558d5c10d87962b8f1.info
        |       |-- 3d9b894478eea73fae540a3c6900133702ad88e0dbb703558d5c10d87962b8f1.lock
        |       |-- 4a22365141bc4eea5d5ac4a1395e653f2669485db75ef119e7bbec8e19b12a21
        |       |-- 4a22365141bc4eea5d5ac4a1395e653f2669485db75ef119e7bbec8e19b12a21.info
        |       |-- 4a22365141bc4eea5d5ac4a1395e653f2669485db75ef119e7bbec8e19b12a21.lock
        |       |-- 5b03666c2d7b526129bad48c5cea095aad8b83badc1daa202e7b0279e3a5d861
        |       |-- 5b03666c2d7b526129bad48c5cea095aad8b83badc1daa202e7b0279e3a5d861.info
        |       |-- 5b03666c2d7b526129bad48c5cea095aad8b83badc1daa202e7b0279e3a5d861.lock
        |       |-- 5c9bf7c1f1703ada412b15f25fe9823c0520278a873c6408060a99ea99e1f38e
        |       |-- 5c9bf7c1f1703ada412b15f25fe9823c0520278a873c6408060a99ea99e1f38e.info
        |       |-- 5c9bf7c1f1703ada412b15f25fe9823c0520278a873c6408060a99ea99e1f38e.lock
        |       |-- 60a9437416860492593650e193a1cf609f2902b80f52b9c964888a14bbb4be1c
        |       |-- 60a9437416860492593650e193a1cf609f2902b80f52b9c964888a14bbb4be1c.info
        |       |-- 60a9437416860492593650e193a1cf609f2902b80f52b9c964888a14bbb4be1c.lock
        |       |-- 76a8992ccba6d77c6bcf031ff2b6d821cf232e4ad8d1f2362404fbd0a798d846
        |       |-- 76a8992ccba6d77c6bcf031ff2b6d821cf232e4ad8d1f2362404fbd0a798d846.info
        |       |-- 76a8992ccba6d77c6bcf031ff2b6d821cf232e4ad8d1f2362404fbd0a798d846.lock
        |       |-- b7497faebb7c089572d87623a2670f0affcfebc950e7ccadab2b5959887cf2c3
        |       |-- b7497faebb7c089572d87623a2670f0affcfebc950e7ccadab2b5959887cf2c3.info
        |       |-- b7497faebb7c089572d87623a2670f0affcfebc950e7ccadab2b5959887cf2c3.lock
        |       |-- de5fd3af413a4f3f969455ae522b4002fcb7bb4c158f339396dfc77710c9007d
        |       |-- de5fd3af413a4f3f969455ae522b4002fcb7bb4c158f339396dfc77710c9007d.info
        |       `-- de5fd3af413a4f3f969455ae522b4002fcb7bb4c158f339396dfc77710c9007d.lock
        |-- github.com
        |   `-- golang
        |       |-- [email protected]
        |       |-- [email protected]
        |       `-- [email protected]
        `-- golang.org
            `-- x
                |-- [email protected]
                |-- [email protected]
                |-- [email protected]
                |-- [email protected]
                |-- [email protected]
                `-- [email protected]

@bcmills
Copy link
Contributor

bcmills commented Apr 12, 2019

The error message here is correct. There is no importable package at the root of the golang.org/x/crypto module, and there is no other module providing such a package.

@bcmills bcmills closed this as completed Apr 12, 2019
@golang golang locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants