Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Current Operator version
VERSION ?= 0.0.1
VERSIONSDK ?= 1.2.0

.PHONY: \
clean \
Expand All @@ -14,7 +15,8 @@ VERSION ?= 0.0.1

SOURCES := $(shell find . -name '*.go' -not -path "*/vendor/*")
GOBUILDFLAGS ?= -i -mod=vendor
GOLDFLAGS ?= -s -w -X github.com/openshift/cincinnati-operator/version.Operator=$(VERSION)
GOLDFLAGS ?= -s -w -X github.com/openshift/cincinnati-operator/version.versionOperator=$(VERSION) \
-X github.com/openshift/cincinnati-operator/version.versionSDK=$(VERSIONSDK)

# This is a placeholder for cincinnati-operator image placeholder
# During development override this when you want to use an specific image
Expand Down
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ func init() {
}

func printVersion() {
log.Info(fmt.Sprintf("Operator Version: %s", version.Operator))
log.Info(fmt.Sprintf("Go Version: %s", runtime.Version()))
log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
log.Info(fmt.Sprintf("version: v%s", version.VersionOperator))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from Operator Version?

Copy link
Member Author

@LalatenduMohanty LalatenduMohanty Dec 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean from version.Operator to version.VersionOperator ? to keep it consistent with Version.VersionSDK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the label string from "Operator Version:" which seems more clear?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change ti to operator version

log.Info(fmt.Sprintf("operator-sdk version: v%s", version.VersionSDK))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am in favor of the Makefile change, but would rather keep this out of Go, see here and that commit message. Is there a benefit to storing this information in Go?

log.Info(fmt.Sprintf("go Version: %s", runtime.Version()))
log.Info(fmt.Sprintf("go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the downcasing? The Go project name is canonically title case, e.g. see examples here.

}

// getWatchNamespace returns the Namespace the operator should be watching for changes
Expand Down
3 changes: 2 additions & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package version

var (
VersionSDK = "0.0.0-unset"
// Operator is the version of the operator.
Operator = "was not built correctly"
VersionOperator = "0.0.0-unset"
)