douhan0562 2016-05-08 13:53
浏览 38
已采纳

在AppEngine / Go中获取当前部署的时间戳

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.

  • 写回答

1条回答 默认 最新

  • dsa80833 2016-05-08 15:26
    关注

    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]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动