Files
athens/pkg/build/build.go
Ashish Ranjan 3f26845cff move to github actions from drone (#1823)
* add github actions workflow for tag releases

* migrate drone build &test step to github actions

* fix minio service

* fix indentation

* fix dependency syntax

* remove needs keyword

* fix service hostnames, add protectedredis

* update protected redis docker image

* fix too many args error

* exclude vendor dir from gofmt

* fix fmt errors

* fix fmt errors

* rm .drone.yml

* rename workflow name

* break test step

* remove vendor step

* use makefile rule

* use buildx
2023-02-22 22:47:37 -08:00

39 lines
999 B
Go

// Package build provides details of the built binary
// The details are set using ldflags.
//
// The ldflags can be set manually for testing locally:
// `go build -ldflags "-X github.com/gomods/athens/pkg/build.version=$(git describe --tags) -X github.com/gomods/athens/pkg/build.buildDate=$(date -u +%Y-%m-%d-%H:%M:%S-%Z)"`
package build
import (
"fmt"
)
// Details represents known data for a given build
type Details struct {
Version string `json:"version,omitempty"`
Date string `json:"date,omitempty"`
}
var version, buildDate string
// String returns build details as a string with formatting
// suitable for console output.
//
// i.e.
// Build Details:
//
// Version: v0.1.0-155-g1a20f8b
// Date: 2018-11-05-14:33:14-UTC
func String() string {
return fmt.Sprintf("Build Details:\n\tVersion:\t%s\n\tDate:\t\t%s", version, buildDate)
}
// Data returns build details as a struct
func Data() Details {
return Details{
Version: version,
Date: buildDate,
}
}