-
Notifications
You must be signed in to change notification settings - Fork 352
fix: replace the hardcoded default version string (#1836) #1900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,10 @@ | |
| // Package util contains utility functions for use throughout the Cloud SQL Auth proxy. | ||
| package util | ||
|
|
||
| import "strings" | ||
| import ( | ||
| _ "embed" | ||
| "strings" | ||
| ) | ||
|
|
||
| // SplitName splits a fully qualified instance into its project, region, and | ||
| // instance name components. While we make the transition to regionalized | ||
|
|
@@ -44,3 +47,26 @@ func SplitName(instance string) (project, region, name string) { | |
| return spl[0], spl[1], spl[2] | ||
| } | ||
| } | ||
|
|
||
| // versionString indicates the version of the proxy currently in use. | ||
| // | ||
| //go:embed version.txt | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need to move version.txt to this directory. Also, we'll need to update the location of this file in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. version.txt has been moved under proxy/util.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Jack told me offline that the release-please.yml file in main branch needs to be updated. So created this PR #1904. Please let me know if that looks OK. Thanks! |
||
| var versionString string | ||
|
|
||
| // metadataString indicates additional build or distribution metadata. | ||
| var metadataString = "" | ||
|
|
||
| // semanticVersion returns the version of the proxy in a semver format. | ||
| func SemanticVersion() string { | ||
| v := strings.TrimSpace(versionString) | ||
| if metadataString != "" { | ||
| v += "+" + metadataString | ||
| } | ||
| return v | ||
| } | ||
|
|
||
| // userAgentFromVersionString returns an appropriate user agent string | ||
| // for identifying this proxy process. | ||
| func UserAgentFromVersionString() string { | ||
| return "cloud_sql_proxy/" + SemanticVersion() | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.