Skip to content

Instantly share code, notes, and snippets.

@jpbetz
Last active December 15, 2017 01:20
Show Gist options
  • Save jpbetz/2909720a2276a0303ca68f92b776a7c1 to your computer and use it in GitHub Desktop.
Save jpbetz/2909720a2276a0303ca68f92b776a7c1 to your computer and use it in GitHub Desktop.
Reproduces godep save issue encountered when upgrading kubernetes from grpc 1.3.0 to 1.7.4 (https://github.com/kubernetes/kubernetes/pull/57160)
export GOPATH=$(mktemp -d)
export PATH=$GOPATH/bin:$PATH
echo "Running in temp dir: ${GOPATH}"
go get github.com/tools/godep
export REPO=$GOPATH/src/github.com/jpbetz
mkdir -p $REPO/p3/a/b
cat > $REPO/p3/a/a.go <<EOT
package a
func Message() string {
return "OK"
}
EOT
cat > $REPO/p3/a/b/b.go <<EOT
package b
import "github.com/jpbetz/p3/a"
func Message() string {
return a.Message()
}
EOT
cd $REPO/p3
git init
git add --all
git commit -m "Initial commit"
git tag -a v1.0.0 -m "v1.0.0 tag"
mkdir -p $REPO/p2
cat > $REPO/p2/p2.go <<EOT
package p2
import "fmt"
import "github.com/jpbetz/p3/a/b"
func Message() string {
return fmt.Sprintf("p3: %s", b.Message())
}
EOT
cd $REPO/p2
godep save
git init
git add --all
git commit -m "Initial commit"
cd $REPO/p3
rm -f $REPO/p3/a/a.go
rm -rf $REPO/p3/a/b/b.go
cat > $REPO/p3/a/b/b.go <<EOT
package b
func Message() string {
return "OK"
}
EOT
git add --all
git commit -m "Remove a.go"
git tag -a v1.1.0 -m "v1.1.0 tag"
mkdir -p $REPO/p1
cat > $REPO/p1/p1.go <<EOT
package main
import "fmt"
import "github.com/jpbetz/p2"
import "github.com/jpbetz/p3/a/b"
func main() {
fmt.Printf("p2: %s, p3: %s", p2.Message(), b.Message())
}
EOT
# Uncommenting this makes the test pass
# cat > $REPO/p3/a/doc.go <<EOT
# package a
# EOT
cd $REPO/p1
godep save ./...
godep restore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment