Skip to content

cmd/go: go mod does support directory packages #28716

@clearcodecn

Description

@clearcodecn

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

$ go version
go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mrj/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mrj/Desktop/vendor"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/mrj/Desktop/echo-basic/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=/var/folders/4v/knjv8mkn7931qlfdfc7s3v140000gn/T/go-build634382221=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I want to replace the pkg: golang.org/x/crypto/acme/autocert to github.com/golang/crypto/acme/autocert

this is my go.mod file

replace golang.org/x/crypto/acme/autocert => github.com/golang/crypto/acme/autocert v0.0.0-20181106171534-e4dc69e5b2fd

but It was wrong!

➜  server go run -v root.go 
Fetching https://golang.org/x/crypto/acme/autocert?go-get=1
^C
➜  server go run -v main.go
Fetching https://golang.org/x/crypto/acme/autocert?go-get=1
https fetch failed: Get https://golang.org/x/crypto/acme/autocert?go-get=1: dial tcp 216.239.37.1:443: i/o timeout
Fetching https://golang.org/x/crypto/acme?go-get=1
https fetch failed: Get https://golang.org/x/crypto/acme?go-get=1: dial tcp 216.239.37.1:443: i/o timeout
Fetching https://golang.org/x/crypto?go-get=1

it doest replace golang.orgtogithub.com`

What did you expect to see?

I want to see download from github.com

What did you see instead?

https fetch failed: Get https://golang.org/x?go-get=1: dial tcp 216.239.37.1:443: i/o timeout
Fetching https://golang.org?go-get=1

How should I write the go.mod file correct ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions