1
0
mirror of https://github.com/golang/go synced 2024-11-07 20:16:10 -07:00

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 <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Bryan C. Mills 2018-08-06 18:06:06 -04:00
parent a618efd7d8
commit 28cee7075e
3 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,23 @@
research.swtch.com/vgo-tour@v1.0.0
-- .mod --
module "research.swtch.com/vgo-tour"
-- .info --
{"Version":"v1.0.0","Name":"84de74b35823c1e49634f2262f1a58cfc951ebae","Short":"84de74b35823","Time":"2018-02-20T00:04:00Z"}
-- go.mod --
module "research.swtch.com/vgo-tour"
-- hello.go --
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"rsc.io/quote"
)
func main() {
fmt.Println(quote.Hello())
}

View File

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

View File

@ -0,0 +1,16 @@
env GO111MODULE=on
go mod init example.com/m
# get of a binary should install it to $GOPATH/bin
# BUG: vgo-tour should be installed as vgo-tour, not vgo-tour@v1.0.0.
go get research.swtch.com/vgo-tour
exec $GOPATH/bin/vgo-tour@v1.0.0
stdout 'Hello, world.'
rm $GOPATH/bin/vgo-tour@v1.0.0
# install of a binary should install it to $GOPATH/bin
# BUG: vgo-tour should be installed as vgo-tour, not vgo-tour@v1.0.0.
go install research.swtch.com/vgo-tour
exec $GOPATH/bin/vgo-tour@v1.0.0
stdout 'Hello, world.'