Verified Commit 53db3dff authored by Che's avatar Che
Browse files

Prepare release

- Fix project namespace (closes #1)
- Use gophers/sysexit for exit codes
- [cmd] Add extended module version output when combined with verbose
  flag
- [Make] Add job work
- [mod] Update lab.lostb.one/gophers/clog to v0.5.2
- [mod] Update lab.lostb.one/gophers/feta to v0.4.0
- [mod] Add lab.lostb.one/gophers/sysexit v0.2.1
- [mod] Update lab.lostb.one/gophers/text to v0.2.2
parent 35c10d07
Pipeline #937 passed with stage
in 5 minutes and 8 seconds
......@@ -3,6 +3,8 @@
- Add Code of Conduct
- Update .gitignore definitions
- Fix linting errors reported by wsl
- Fix project namespace (closes #1)
- Use gophers/sysexit for exit codes
- [proj] Add tag type via tag.Categorize function
- [cmd] Move startup output to verbose stream
- Add first tests
......@@ -24,6 +26,7 @@
- [cmd] Remove startup output
- [proj] Add loodd (local-out-of-date-detection) processing and state checks
- [proj] Add visual indicators for loodd
- [cmd] Add extended module version output when combined with verbose flag
- [README] Link to Code of Conduct
- [Make] Make better use of already defined variables
- [Make] Improve golangci-lint run call
......@@ -31,6 +34,7 @@
- [Make] Apply Go 1.13 fixes from gophers/ci-tmpl@fad9af3f
- [Make] Use go build -trimpath to improve build reproducibility
- [Make] Remove linux-amd64-static job
- [Make] Add job work
- [CI] Remove linux-amd64-static job
- [scripts] Adapt buildscript.go from gophers/ci-tmpl
- [scripts] Remove vendor workaround from coverage script
......@@ -40,6 +44,10 @@
- [mod] Update lab.madbox.synology.me/gophers/feta to v0.3.0
- [mod] Add lab.madbox.synology.me/gophers/text v0.2.0
- [mod] Update lab.madbox.synology.me/gophers/text to v0.2.1
- [mod] Update lab.lostb.one/gophers/clog to v0.5.2
- [mod] Update lab.lostb.one/gophers/feta to v0.4.0
- [mod] Add lab.lostb.one/gophers/sysexit v0.2.1
- [mod] Update lab.lostb.one/gophers/text to v0.2.2
# v0.1.0
......
PKGS := $(shell go list ./...)
BIN_DIR := $(GOPATH)/bin
GOLANGCI-LINT := $(BIN_DIR)/golangci-lint
UPSTREAM_BASE := "https://lab.madbox.synology.me/gophers/ci-tmpl/raw/master"
UPSTREAM_BASE := "https://lab.lostb.one/gophers/ci-tmpl/raw/master"
GO113FIXES=GOPROXY=direct GOSUMDB=off
BINARY := goamod
XFLAGS=$(shell go run scripts/buildscript.go -path lab.madbox.synology.me/gophers/$(BINARY)/internal/pkg/build)
BUILDPKG := "lab.madbox.synology.me/gophers/$(BINARY)/cmd/$(BINARY)"
XFLAGS=$(shell go run scripts/buildscript.go -path lab.lostb.one/gophers/$(BINARY)/internal/pkg/build)
BUILDPKG := "lab.lostb.one/gophers/$(BINARY)/cmd/$(BINARY)"
.PHONY: test
test: lint ## Lint & test the files
......@@ -63,6 +63,10 @@ update-scripts: ## Update the currently used scripts
curl -o scripts/buildscript.go $(UPSTREAM_BASE)/scripts/buildscript.go
curl -o scripts/coverage.sh $(UPSTREAM_BASE)/scripts/coverage.sh
.PHONY: work
work: ## Find outstanding work (BUG|FIXME|TODO comments)
grep --color=auto -niEr '// (BUG|FIXME|TODO) .*' --exclude-dir='scripts' * || true
.PHONY: help
help: ## Display this help screen
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# goamod
[![pipeline status](https://lab.madbox.synology.me/gophers/goamod/badges/master/pipeline.svg)](https://lab.madbox.synology.me/gophers/goamod/pipelines)
[![coverage report](https://lab.madbox.synology.me/gophers/goamod/badges/master/coverage.svg)](https://lab.madbox.synology.me/gophers/goamod)
[![pipeline status](https://lab.lostb.one/gophers/goamod/badges/master/pipeline.svg)](https://lab.lostb.one/gophers/goamod/pipelines)
[![coverage report](https://lab.lostb.one/gophers/goamod/badges/master/coverage.svg)](https://lab.lostb.one/gophers/goamod)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](code-of-conduct.md)
Go analyze module
## Download
If you would like to give goamod a try but don't want to build the project yourself, you can find prebuilt binaries available for download on the [Releases](https://lab.madbox.synology.me/gophers/goamod/releases) page.
If you would like to give goamod a try but don't want to build the project yourself, you can find prebuilt binaries available for download on the [Releases](https://lab.lostb.one/gophers/goamod/releases) page.
In case you would like to know how these binaries are created, have a look at the: [.gitlab-ci.yml](.gitlab-ci.yml).
......
......@@ -5,11 +5,13 @@ import (
"flag"
"fmt"
"os"
"runtime/debug"
"lab.madbox.synology.me/gophers/clog"
"lab.lostb.one/gophers/clog"
"lab.lostb.one/gophers/sysexit"
"lab.madbox.synology.me/gophers/goamod/internal/pkg/build"
"lab.madbox.synology.me/gophers/goamod/internal/pkg/proj"
"lab.lostb.one/gophers/goamod/internal/pkg/build"
"lab.lostb.one/gophers/goamod/internal/pkg/proj"
)
const (
......@@ -46,15 +48,26 @@ func main() {
}
if args.Version {
printVersion()
os.Exit(0)
printVersion(args.Verbose)
os.Exit(sysexit.Ok)
}
proj.Analyze(args.Recursive, !args.State)
}
func printVersion() {
func printVersion(extended bool) {
fmt.Println(build.LongVersion)
if extended {
if info, ok := debug.ReadBuildInfo(); ok {
fmt.Printf("\tpath\t%s\n", info.Path)
fmt.Printf("\tmod\t%s\t%s\t%s\n", info.Main.Path, info.Main.Version, info.Main.Sum)
for _, dep := range info.Deps {
fmt.Printf("\tdep\t%s\t%s\t%s\n", dep.Path, dep.Version, dep.Sum)
}
}
}
}
func printHelp() {
......
......@@ -11,9 +11,10 @@ import (
"path/filepath"
"strings"
"lab.madbox.synology.me/gophers/clog"
"lab.madbox.synology.me/gophers/feta/pkg/tag"
"lab.madbox.synology.me/gophers/text"
"lab.lostb.one/gophers/clog"
"lab.lostb.one/gophers/feta/pkg/tag"
"lab.lostb.one/gophers/sysexit"
"lab.lostb.one/gophers/text"
)
// All "real" code for the moment
......@@ -45,14 +46,14 @@ func Analyze(recursive bool, state bool) {
mods, err := getModPaths(recursive)
if err != nil {
fmt.Println("error while resolving go.mod paths:", err)
os.Exit(1)
os.Exit(sysexit.Fail)
}
clog.Verbf("[verb] mods: %+v\n", mods)
if len(mods) == 0 {
fmt.Println("could not find any go modules!")
os.Exit(1)
os.Exit(sysexit.Fail)
}
actual := make([]mod, len(mods))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment