Can I get the deployed timestamp of current application version in AppEngine/Go?
It seems helpful, but not sure how to implement in AppEngine/Go application code.
Can I get the deployed timestamp of current application version in AppEngine/Go?
It seems helpful, but not sure how to implement in AppEngine/Go application code.
From this link AppEngine: Get current serving application version, the suggested answer is written in python
os.environ['CURRENT_VERSION_ID']
Above code is trying to retrieve the environment variable with name CURRENT_VERSION_ID
, Equivalent code in go
would be:
import (
...
"os"
)
...
versionText := os.Getenv("CURRENT_VERSION_ID")
According to one of the comments, the result would be in this format my-version.383096322806301043
, you should use strings.Split
method to split it by .
, eg:
import (
...
"strings"
)
...
timestampString := strings.Split(versionText, ".")[1]