Skip to content

Commit

Permalink
Merge pull request rook#2090 from ganeshmaharaj/go1.11
Browse files Browse the repository at this point in the history
golang 1.11 support
  • Loading branch information
bassam authored Sep 13, 2018
2 parents 6d50c73 + 98cefc6 commit 03e5242
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 20 deletions.
23 changes: 20 additions & 3 deletions build/makelib/golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ GOJUNIT := $(TOOLS_HOST_DIR)/go-junit-report

GO := go
GOHOST := GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go
GO_VERSION := $(shell $(GO) version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p')

# we use a consistent version of gofmt even while running different go compilers.
# see https://github.com/golang/go/issues/26397 for more details
GOFMT_VERSION := 1.11
ifneq ($(findstring $(GOFMT_VERSION),$(GO_VERSION)),)
GOFMT := $(shell which gofmt)
else
GOFMT := $(TOOLS_HOST_DIR)/gofmt$(GOFMT_VERSION)
endif

GO_OUT_DIR := $(abspath $(OUTPUT_DIR)/bin/$(PLATFORM))
GO_TEST_OUTPUT := $(abspath $(OUTPUT_DIR)/tests/$(PLATFORM))
Expand Down Expand Up @@ -148,11 +158,11 @@ go.lint: $(GOLINT)
.PHONY: go.vet
go.vet:
@echo === go vet
@$(GOHOST) vet $(GO_COMMON_FLAGS) $(GO_PACKAGES) $(GO_INTEGRATION_TEST_PACKAGES)
@CGO_ENABLED=0 $(GOHOST) vet $(GO_COMMON_FLAGS) $(GO_PACKAGES) $(GO_INTEGRATION_TEST_PACKAGES)

.PHONY: go.fmt
go.fmt:
@gofmt_out=$$(gofmt -s -d -e $(GO_SUBDIRS) $(GO_INTEGRATION_TESTS_SUBDIRS) 2>&1) && [ -z "$${gofmt_out}" ] || (echo "$${gofmt_out}" 1>&2; exit 1)
go.fmt: $(GOFMT)
@gofmt_out=$$($(GOFMT) -s -d -e $(GO_SUBDIRS) $(GO_INTEGRATION_TESTS_SUBDIRS) 2>&1) && [ -z "$${gofmt_out}" ] || (echo "$${gofmt_out}" 1>&2; exit 1)

go.validate: go.vet go.fmt

Expand Down Expand Up @@ -188,6 +198,13 @@ $(GOLINT):
@GOPATH=$(TOOLS_HOST_DIR)/tmp GOBIN=$(TOOLS_HOST_DIR) $(GOHOST) get github.com/golang/lint/golint
@rm -fr $(TOOLS_HOST_DIR)/tmp

$(GOFMT):
@echo === installing gofmt$(GOFMT_VERSION)
@mkdir -p $(TOOLS_HOST_DIR)/tmp
@curl -sL https://dl.google.com/go/go$(GOFMT_VERSION).$(GOHOSTOS)-$(GOHOSTARCH).tar.gz | tar -xz -C $(TOOLS_HOST_DIR)/tmp
@mv $(TOOLS_HOST_DIR)/tmp/go/bin/gofmt $(GOFMT)
@rm -fr $(TOOLS_HOST_DIR)/tmp

$(GOJUNIT):
@echo === installing go-junit-report
@mkdir -p $(TOOLS_HOST_DIR)/tmp
Expand Down
4 changes: 2 additions & 2 deletions images/cross/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# install go-lang from the official repo
RUN GO_VERSION=1.10.1 && \
GO_HASH=72d820dec546752e5a8303b33b009079c15c2390ce76d67cf514991646c6127b && \
RUN GO_VERSION=1.11 && \
GO_HASH=b3fcf280ff86558e0559e185b601c9eade0fd24c900b4c63cd14d1d38613e499 && \
curl -fsSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o golang.tar.gz && \
echo "${GO_HASH} golang.tar.gz" | sha256sum -c - && \
tar -C /usr/local -xzf golang.tar.gz && \
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/ceph/file/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (c *FilesystemController) onUpdate(oldObj, newObj interface{}) {
}

// if the file system is modified, allow the file system to be created if it wasn't already
logger.Infof("updating filesystem %s", newFS)
logger.Infof("updating filesystem %s", newFS.Name)
err = CreateFilesystem(c.context, *newFS, c.rookImage, c.hostNetwork, c.filesystemOwners(newFS))
if err != nil {
logger.Errorf("failed to create (modify) file system %s. %+v", newFS.Name, err)
Expand Down
6 changes: 3 additions & 3 deletions pkg/operator/ceph/provisioner/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,9 @@ func (ctrl *ProvisionController) provisionClaimOperation(claim *v1.PersistentVol
options := VolumeOptions{
// TODO SHOULD be set to `Delete` unless user manually configures other reclaim policy.
PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
PVName: pvName,
PVC: claim,
Parameters: parameters,
PVName: pvName,
PVC: claim,
Parameters: parameters,
}

ctrl.eventRecorder.Event(claim, v1.EventTypeNormal, "Provisioning", fmt.Sprintf("External provisioner is provisioning volume for claim %q", claimToClaimKey(claim)))
Expand Down
6 changes: 3 additions & 3 deletions pkg/operator/ceph/provisioner/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ func newProvisionedVolume(storageClass *storagebeta.StorageClass, claim *v1.Pers
// pv.Spec MUST be set to match requirements in claim.Spec, especially access mode and PV size. The provisioned volume size MUST NOT be smaller than size requested in the claim, however it MAY be larger.
options := VolumeOptions{
PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
PVName: "pvc-" + string(claim.ObjectMeta.UID),
PVC: claim,
Parameters: storageClass.Parameters,
PVName: "pvc-" + string(claim.ObjectMeta.UID),
PVC: claim,
Parameters: storageClass.Parameters,
}
volume, _ := newTestProvisioner().Provision(options)

Expand Down
6 changes: 3 additions & 3 deletions pkg/operator/ceph/provisioner/provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ func TestParseClassParametersInvalidOption(t *testing.T) {
func newVolumeOptions(storageClass *storagebeta.StorageClass, claim *v1.PersistentVolumeClaim) controller.VolumeOptions {
return controller.VolumeOptions{
PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
PVName: "pvc-" + string(claim.ObjectMeta.UID),
PVC: claim,
Parameters: storageClass.Parameters,
PVName: "pvc-" + string(claim.ObjectMeta.UID),
PVC: claim,
Parameters: storageClass.Parameters,
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/operator/cockroachdb/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ func (c *ClusterController) createReplicaService(cluster *cluster) error {
// field is broken in some versions of Kubernetes:
// https://github.com/kubernetes/kubernetes/issues/58662
"service.alpha.kubernetes.io/tolerate-unready-endpoints": "true",
"prometheus.io/scrape": "true",
"prometheus.io/path": "_status/vars",
"prometheus.io/port": strconv.Itoa(int(httpPort)),
"prometheus.io/scrape": "true",
"prometheus.io/path": "_status/vars",
"prometheus.io/port": strconv.Itoa(int(httpPort)),
},
},
Spec: v1.ServiceSpec{
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/proc/monitoredproc.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type MonitoredProc struct {

func newMonitoredProc(p *ProcManager, cmd *exec.Cmd) *MonitoredProc {
m := &MonitoredProc{
parent: p,
cmd: cmd,
parent: p,
cmd: cmd,
retrySecondsExponentBase: 2,
}
m.waitForExit = m.waitForProcessExit
Expand Down

0 comments on commit 03e5242

Please sign in to comment.