Skip to content

Commit

Permalink
go.mod/go.sum: add a go.mod and go.sum file for golang.org/x/example
Browse files Browse the repository at this point in the history
Add a go.mod and go.sum file for the example repo. Updates the import
path for the packages in this repository to begin with
golang.org/x/example.

Change-Id: I79a8dcfff9cebd4aa8586c57f19f86305a213598
Reviewed-on: https://go-review.googlesource.com/c/example/+/283332
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
  • Loading branch information
suzmue committed Jan 13, 2021
1 parent 46695d8 commit bcf50bf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module golang.org/x/example

go 1.15

require golang.org/x/tools v0.0.0-20210112183307-1e6ecd4bf1b0
24 changes: 24 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20210112183307-1e6ecd4bf1b0 h1:iZhiQWrjyEuXG495d9MXkcmhrlxbQyGp0uNBY+YBZDk=
golang.org/x/tools v0.0.0-20210112183307-1e6ecd4bf1b0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
2 changes: 1 addition & 1 deletion hello/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"fmt"

"github.com/golang/example/stringutil"

This comment has been minimized.

Copy link
@WsJJZc

WsJJZc Dec 17, 2022

http://www.github.com/golang/example@v0.0.0-20210113200257-bcf50bfd7dcd: parsing go.mod:
module declares its path as: golang.org/x/example

"golang.org/x/example/stringutil"
)

func main() {
Expand Down

2 comments on commit bcf50bf

@asottile
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the example in the README.

Here's an example script:

#!/usr/bin/env bash
set -euxo pipefail

chmod -R +w gopath
rm -rf gopath go.mod

mkdir gopath
export GOPATH="$PWD/gopath"

cat > go.mod <<EOF
module example

go 1.14
EOF

go get github.com/golang/example/hello

and output:

$ bash t.sh 
+ chmod -R +w gopath
+ rm -rf gopath go.mod
+ mkdir gopath
+ export GOPATH=/tmp/z/gopath
+ GOPATH=/tmp/z/gopath
+ cat
+ go get github.com/golang/example/hello
go: downloading github.com/golang/example v0.0.0-20210113200257-bcf50bfd7dcd
go: found github.com/golang/example/hello in github.com/golang/example v0.0.0-20210113200257-bcf50bfd7dcd
go get: github.com/golang/example@v0.0.0-20210113200257-bcf50bfd7dcd: parsing go.mod:
	module declares its path as: golang.org/x/example
	        but was required as: github.com/golang/example

@AdrewOtr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the example in the README.

Here's an example script:

#!/usr/bin/env bash
set -euxo pipefail

chmod -R +w gopath
rm -rf gopath go.mod

mkdir gopath
export GOPATH="$PWD/gopath"

cat > go.mod <<EOF
module example

go 1.14
EOF

go get github.com/golang/example/hello

and output:

$ bash t.sh 
+ chmod -R +w gopath
+ rm -rf gopath go.mod
+ mkdir gopath
+ export GOPATH=/tmp/z/gopath
+ GOPATH=/tmp/z/gopath
+ cat
+ go get github.com/golang/example/hello
go: downloading github.com/golang/example v0.0.0-20210113200257-bcf50bfd7dcd
go: found github.com/golang/example/hello in github.com/golang/example v0.0.0-20210113200257-bcf50bfd7dcd
go get: github.com/golang/example@v0.0.0-20210113200257-bcf50bfd7dcd: parsing go.mod:
	module declares its path as: golang.org/x/example
	        but was required as: github.com/golang/example

I have the same problem after installing go1.16.2 windows/amd64 on my laptop and setting GOPATH(C:\Projects\Go) and Path(C:\Program Files\Go\bin) in Environment System Variables. Can't find the solution to the problem.

Please sign in to comment.