Day 1. test build should work
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
commit
2c6dc806ef
|
@ -0,0 +1,7 @@
|
||||||
|
*.swp
|
||||||
|
go.mod
|
||||||
|
go.sum
|
||||||
|
/files/*
|
||||||
|
/work/*
|
||||||
|
|
||||||
|
going2git
|
|
@ -0,0 +1,22 @@
|
||||||
|
VERSION = $(shell git describe --tags)
|
||||||
|
GUIVERSION = $(shell git describe --tags)
|
||||||
|
BUILDTIME = $(shell date +%s)
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build: goimports
|
||||||
|
GO111MODULE=off go build -v -x \
|
||||||
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
./going2git -h
|
||||||
|
|
||||||
|
vet:
|
||||||
|
GO111MODULE=off go vet
|
||||||
|
|
||||||
|
goimports:
|
||||||
|
goimports -w *.go
|
||||||
|
# // to globally reset paths:
|
||||||
|
# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
||||||
|
|
||||||
|
install: goimports
|
||||||
|
GO111MODULE=off go install \
|
||||||
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
|
@ -0,0 +1,33 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
/*
|
||||||
|
this parses the command line arguements
|
||||||
|
*/
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/dev/alexflint/arg"
|
||||||
|
)
|
||||||
|
|
||||||
|
var argv args
|
||||||
|
|
||||||
|
type args struct {
|
||||||
|
Repo string `arg:"--repo" default:"/etc/gowebd/repomap" help:"what .git repo to use?"`
|
||||||
|
Hostname string `arg:"--hostname" default:"go.wit.com" help:"hostname to use"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (args) Version() string {
|
||||||
|
return "going2git " + VERSION + " Built on " + BUILDTIME
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
arg.MustParse(&argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a args) Description() string {
|
||||||
|
return `
|
||||||
|
This is a demo of git2go to show how it works.
|
||||||
|
|
||||||
|
Actually, I don't know how to use libgit2 or git2go yet so really this is just
|
||||||
|
an example of how to compile something against it.
|
||||||
|
`
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
git "go.wit.com/lib/libgit2"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
// are sent via -ldflags at buildtime
|
||||||
|
var VERSION string
|
||||||
|
var BUILDTIME string
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var input git.Trailer
|
||||||
|
|
||||||
|
input.Key = "Co-authored-by"
|
||||||
|
input.Value = "Alice <alice@example.com>"
|
||||||
|
/*
|
||||||
|
git2go.Trailer
|
||||||
|
git2go.Trailer{Key: "Signed-off-by", Value: "Bob <bob@example.com>"}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
fmt.Printf("%s", input)
|
||||||
|
actual, err := git.MessageTrailers(input.Key)
|
||||||
|
log.Info("actual", actual, err)
|
||||||
|
}
|
Loading…
Reference in New Issue