mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-03-13 13:39:02 -05:00
Added go generate command for version number in templates
This commit is contained in:
@@ -6,6 +6,7 @@ set -e
|
||||
targets=${@-"darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 windows/amd64 windows/386"}
|
||||
|
||||
cd /usr/src/myapp
|
||||
go generate
|
||||
|
||||
for target in $targets; do
|
||||
os="$(echo $target | cut -d '/' -f1)"
|
||||
|
||||
@@ -10,7 +10,7 @@ RUN cd /compile && go mod download
|
||||
|
||||
COPY . /compile
|
||||
|
||||
RUN cd /compile && CGO_ENABLED=0 go build -ldflags="-s -w -X 'Gokapi/src/environment.IsDocker=true' -X 'Gokapi/src/environment.Builder=Project Docker File' -X 'Gokapi/src/environment.BuildTime=$(date)'" -o /compile/gokapi
|
||||
RUN cd /compile && go generate && CGO_ENABLED=0 go build -ldflags="-s -w -X 'Gokapi/src/environment.IsDocker=true' -X 'Gokapi/src/environment.Builder=Project Docker File' -X 'Gokapi/src/environment.BuildTime=$(date)'" -o /compile/gokapi
|
||||
|
||||
FROM alpine:3.13
|
||||
|
||||
|
||||
4
Main.go
4
Main.go
@@ -16,8 +16,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// needs to be changed in ./templates/string_constants.tmpl as well
|
||||
// Current version in readable form. Needs to be changed in ./templates/string_constants.tmpl as well,
|
||||
// which can be done with "go generate"
|
||||
const VERSION = "1.1.2"
|
||||
//go:generate sed "-i" "s/{{define \"version\"}}.*{{end}}/{{define \"version\"}}1.1.2{{end}}/g" "./templates/string_constants.tmpl"
|
||||
|
||||
// Main routine that is called on startup
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user