Skip to content

Commit 28cee70

Browse files
author
Bryan C. Mills
committed
cmd/go: test that 'go get pkg@version' installs pkg
This test passes, but it encodes several behaviors that I think are bugs. I suggest that we check it in as-is, and we can update it as the bugs are fixed. Change-Id: Icb073de9cb13036dbccadb4ff2cb3169ffb56236 Reviewed-on: https://go-review.googlesource.com/128137 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent a618efd commit 28cee70

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
research.swtch.com/[email protected]
2+
3+
-- .mod --
4+
module "research.swtch.com/vgo-tour"
5+
-- .info --
6+
{"Version":"v1.0.0","Name":"84de74b35823c1e49634f2262f1a58cfc951ebae","Short":"84de74b35823","Time":"2018-02-20T00:04:00Z"}
7+
-- go.mod --
8+
module "research.swtch.com/vgo-tour"
9+
-- hello.go --
10+
// Copyright 2018 The Go Authors. All rights reserved.
11+
// Use of this source code is governed by a BSD-style
12+
// license that can be found in the LICENSE file.
13+
14+
package main
15+
16+
import (
17+
"fmt"
18+
"rsc.io/quote"
19+
)
20+
21+
func main() {
22+
fmt.Println(quote.Hello())
23+
}

src/cmd/go/testdata/script/mod_get_commit.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ go get -d -x golang.org/x/text/language@14c0d48
2121
go get -x golang.org/x/text/language@14c0d48
2222
stderr 'compile|cp|gccgo .*language\.a$'
2323

24+
# BUG: after the build, the package should not be stale, as 'go install' would
25+
# not do anything further.
26+
go list -f '{{.Stale}}' golang.org/x/text/language
27+
stdout ^true
28+
29+
# install after get should not run the compiler again.
30+
go install -x golang.org/x/text/language
31+
! stderr 'compile|cp|gccgo .*language\.a$'
32+
2433
# even with -d, we should see an error for unknown packages.
2534
! go get -d -x golang.org/x/text/foo@14c0d48
2635

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
env GO111MODULE=on
2+
3+
go mod init example.com/m
4+
5+
# get of a binary should install it to $GOPATH/bin
6+
# BUG: vgo-tour should be installed as vgo-tour, not [email protected].
7+
go get research.swtch.com/vgo-tour
8+
exec $GOPATH/bin/[email protected]
9+
stdout 'Hello, world.'
10+
rm $GOPATH/bin/[email protected]
11+
12+
# install of a binary should install it to $GOPATH/bin
13+
# BUG: vgo-tour should be installed as vgo-tour, not [email protected].
14+
go install research.swtch.com/vgo-tour
15+
exec $GOPATH/bin/[email protected]
16+
stdout 'Hello, world.'

0 commit comments

Comments
 (0)