openshift / open-service-broker-sdk

A starting point for creating service brokers implementing the Open Service Broker API
Apache License 2.0
31 stars 33 forks source link

remove GOPATH to work with symlinks #12

Closed jmrodri closed 7 years ago

jmrodri commented 7 years ago

Checking out this project into a location NOT in the GOPATH, then symlinking it into the GOPATH will now build as expected.

jmrodri commented 7 years ago

Fixes Issue #4

jmrodri commented 7 years ago

BEFORE

[jesusr@speed3 open-service-broker-sdk{work-with-symlinks}]$ make clean
rm -rf bin
rm -f .generate_exes
[jesusr@speed3 open-service-broker-sdk{work-with-symlinks}]$ make test
go build -o bin/defaulter-gen github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/defaulter-gen
can't load package: package github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/defaulter-gen: cannot find package "github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/defaulter-gen" in any of:
    /usr/lib/golang/src/github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/defaulter-gen (from $GOROOT)
    /home/jesusr/dev/open-service-broker-sdk/src/github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/defaulter-gen (from $GOPATH)
    /home/jesusr/dev/open-service-broker-sdk/vendor/src/github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/defaulter-gen
Makefile:87: recipe for target 'bin/defaulter-gen' failed
make: *** [bin/defaulter-gen] Error 1

AFTER

[jesusr@speed3 open-service-broker-sdk{work-with-symlinks}]$ make clean
rm -rf bin
rm -f .generate_exes
[jesusr@speed3 open-service-broker-sdk{work-with-symlinks}]$ make clean
rm -rf bin
rm -f .generate_exes
[jesusr@speed3 open-service-broker-sdk{work-with-symlinks}]$ make test
go build -o bin/defaulter-gen github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/defaulter-gen
go build -o bin/deepcopy-gen github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/deepcopy-gen
go build -o bin/conversion-gen github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/conversion-gen
go build -o bin/client-gen github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/client-gen
go build -o bin/lister-gen github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/lister-gen
go build -o bin/informer-gen github.com/openshift/open-service-broker-sdk/vendor/k8s.io/kubernetes/cmd/libs/go2idl/informer-gen
touch .generate_exes
# Generate defaults
bin/defaulter-gen \
    --v 1 --logtostderr \
    --go-header-file "vendor/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.go.txt" \
    --input-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker" \
    --input-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker/v1alpha1" \
    --extra-peer-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker" \
    --extra-peer-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker/v1alpha1" \
    --output-file-base "zz_generated.defaults"
# Generate deep copies
bin/deepcopy-gen \
    --v 1 --logtostderr \
    --go-header-file "vendor/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.go.txt" \
    --input-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker" \
    --input-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker/v1alpha1" \
    --bounding-dirs "github.com/openshift/open-service-broker-sdk" \
    --output-file-base zz_generated.deepcopy
# Generate conversions
bin/conversion-gen \
    --v 1 --logtostderr \
    --go-header-file "vendor/github.com/kubernetes/repo-infra/verify/boilerplate/boilerplate.go.txt" \
    --input-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker" \
    --input-dirs "github.com/openshift/open-service-broker-sdk/pkg/apis/broker/v1alpha1" \
    --output-file-base zz_generated.conversion
# generate all pkg/client contents
build/update-client-gen.sh
env GOOS=linux GOARCH=amd64 go build -i  -ldflags "-X github.com/openshift/open-service-broker-sdk/pkg.VERSION=76bcdf8-dirty" -o bin/broker github.com/openshift/open-service-broker-sdk/cmd/broker
Running tests:
go test  \
  github.com/openshift/open-service-broker-sdk/pkg/apis/broker/install
ok      github.com/openshift/open-service-broker-sdk/pkg/apis/broker/install    0.055s
jmrodri commented 7 years ago

TEST

jmrodri commented 7 years ago

If you want to see the problem, use the master branch from the above clone and you will see the errors.