Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makefile and licence to version output #127

Merged
merged 2 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: test coverage lint vet

build:
go build
goreleaser:
goreleaser release --snapshot --rm-dis
lint:
go fmt $(go list ./... | grep -v /vendor/)
vet:
go vet $(go list ./... | grep -v /vendor/)
test:
go test -v -cover ./...
coverage:
go test -v -cover -coverprofile=coverage.out ./... &&\
go tool cover -html=coverage.out -o coverage.html
18 changes: 18 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

const License = `
Copyright (C) 2021 NETWAYS GmbH <info@netways.de>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
`
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (

// nolint: gochecknoglobals
var (
version = "0.1.0"
commit = ""
date = ""
// These get filled at build time with the proper vaules
version = "development"
commit = "HEAD"
date = "latest"
)

func main() {
Expand All @@ -28,5 +29,7 @@ func buildVersion() string {
result = fmt.Sprintf("%s\ndate: %s", result, date)
}

result += "\n" + cmd.License

return result
}