Skip to content

Instantly share code, notes, and snippets.

@msarahan
Created September 1, 2017 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msarahan/6a0e646429919ddf22d4e4e04dd9d0a3 to your computer and use it in GitHub Desktop.
Save msarahan/6a0e646429919ddf22d4e4e04dd9d0a3 to your computer and use it in GitHub Desktop.
Compile baggageclaim standalone binary
[root@d350a9013fe3 build_scripts]# wget https://storage.googleapis.com/golang/go1.9.linux-386.tar.gz
[root@d350a9013fe3 build_scripts]# tar -xf go1.9.linux-386.tar.gz
[root@d350a9013fe3 build_scripts]# export GOPATH=${PWD}/baggageclaim/
[root@d350a9013fe3 build_scripts]# export GOROOT=${PWD}/go
[root@d350a9013fe3 build_scripts]# git clone https://github.com/concourse/baggageclaim
Cloning into 'baggageclaim'...
remote: Counting objects: 1999, done.
remote: Total 1999 (delta 0), reused 1 (delta 0), pack-reused 1998
Receiving objects: 100% (1999/1999), 433.82 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1278/1278), done.
[root@d350a9013fe3 build_scripts]# cd baggageclaim/cmd/baggageclaim/
[root@d350a9013fe3 baggageclaim]# ${GOROOT}/bin/go get -v
github.com/concourse/baggageclaim (download)
Fetching https://code.cloudfoundry.org/clock?go-get=1
Parsing meta tags from https://code.cloudfoundry.org/clock?go-get=1 (status code 200)
get "code.cloudfoundry.org/clock": found meta tag get.metaImport{Prefix:"code.cloudfoundry.org/clock", VCS:"git", RepoRoot:"https://github.com/cloudfoundry/clock"} at https://code.cloudfoundry.org/clock?go-get=1
code.cloudfoundry.org/clock (download)
Fetching https://code.cloudfoundry.org/lager?go-get=1
Parsing meta tags from https://code.cloudfoundry.org/lager?go-get=1 (status code 200)
get "code.cloudfoundry.org/lager": found meta tag get.metaImport{Prefix:"code.cloudfoundry.org/lager", VCS:"git", RepoRoot:"https://github.com/cloudfoundry/lager"} at https://code.cloudfoundry.org/lager?go-get=1
code.cloudfoundry.org/lager (download)
github.com/tedsuo/rata (download)
github.com/bmizerany/pat (download)
github.com/nu7hatch/gouuid (download)
github.com/hashicorp/go-multierror (download)
github.com/tedsuo/ifrit (download)
github.com/xoebus/zest (download)
github.com/contraband/holler (download)
github.com/jessevdk/go-flags (download)
go install: no install location for directory /build_scripts/baggageclaim/cmd/baggageclaim outside GOPATH
For more details see: 'go help gopath'
[root@d350a9013fe3 baggageclaim]# ${GOROOT}/bin/go build
# github.com/concourse/baggageclaim/baggageclaimcmd
../../src/github.com/concourse/baggageclaim/baggageclaimcmd/driver_linux.go:30:18: constant 2435016766 overflows int32
../../src/github.com/concourse/baggageclaim/baggageclaimcmd/driver_linux.go:41:42: constant 2435016766 overflows int32
[root@d350a9013fe3 baggageclaim]# cd ../../src/github.com/concourse/baggageclaim/
[root@d350a9013fe3 baggageclaim]# vim baggageclaimcmd/driver_linux.go
[root@d350a9013fe3 baggageclaim]# git diff
diff --git a/baggageclaimcmd/driver_linux.go b/baggageclaimcmd/driver_linux.go
index 2cc9cb5..70d5955 100644
--- a/baggageclaimcmd/driver_linux.go
+++ b/baggageclaimcmd/driver_linux.go
@@ -12,7 +12,7 @@ import (
"github.com/concourse/baggageclaim/volume/driver"
)
-const btrfsFSType = 0x9123683e
+const btrfsFSType = int64(0x9123683e)
func (cmd *BaggageclaimCommand) driver(logger lager.Logger) (volume.Driver, error) {
var fsStat syscall.Statfs_t
@@ -27,7 +27,7 @@ func (cmd *BaggageclaimCommand) driver(logger lager.Logger) (volume.Driver, erro
}
if cmd.Driver == "detect" {
- if fsStat.Type == btrfsFSType {
+ if int64(fsStat.Type) == btrfsFSType {
cmd.Driver = "btrfs"
} else if kernelSupportsOverlay {
cmd.Driver = "overlay"
@@ -38,7 +38,7 @@ func (cmd *BaggageclaimCommand) driver(logger lager.Logger) (volume.Driver, erro
volumesDir := cmd.VolumesDir.Path()
- if cmd.Driver == "btrfs" && fsStat.Type != btrfsFSType {
+ if cmd.Driver == "btrfs" && int64(fsStat.Type) != btrfsFSType {
volumesImage := volumesDir + ".img"
filesystem := fs.New(logger.Session("fs"), volumesImage, volumesDir, cmd.MkfsBin)
[root@d350a9013fe3 baggageclaim]# cd ../../../github.com/concourse/baggageclaim/cmd/baggageclaim/
[root@d350a9013fe3 baggageclaim]# ${GOROOT}/bin/go build
[root@d350a9013fe3 baggageclaim]# ls
baggageclaim main.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment