ldflags

package
v0.0.0-...-deab390 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ldflags @Link https://gitee.com/linngc/webos.gf @Copyright Copyright (c) 2022 webos CLI @Author linngc @License

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildGoTime        = "none" //编译时间
	BuildGitCommit     = "none" //git编译分支
	BuildGitCommitTime = "none" //git最后提交时间和sha值
	BuildGitCommitLog  = "none" //获取源码最近一次 git commit log
)

编译时 指定程序信息 编译 go build -ldflags="-X webos.gf/utility/ldflags.BuildGitCommit=`git rev-parse --abbrev-ref HEAD` -X webos.gf/utility/ldflags.BuildGoTime=`date +'%Y-%m-%d.%H:%M:%S'`"

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	GoFrame   string                 // 编译部署使用:gf版本
	Golang    string                 // 编译部署使用:golang版本
	GitBranch string                 // 编译部署使用:git编译分支
	Time      string                 // 编译部署使用:编译时间
	Data      map[string]interface{} // 其他定制参数
}

func Info

func Info(ctx context.Context) *BuildInfo

Info 获取程序编译信息(注意:开发调试时,无法获取到gbuild包的变量信息)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL