Initial boilerplate: go dep, good logger, makefile (#2)
This commit is contained in:
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -0,0 +1,3 @@
|
|||||||
|
/browserpass
|
||||||
|
/browserpass-*
|
||||||
|
vendor/
|
||||||
|
30
Gopkg.lock
generated
Normal file
30
Gopkg.lock
generated
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||||
|
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/sirupsen/logrus"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc"
|
||||||
|
version = "v1.0.5"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "golang.org/x/crypto"
|
||||||
|
packages = ["ssh/terminal"]
|
||||||
|
revision = "beb2a9779c3b677077c41673505f150149fce895"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "golang.org/x/sys"
|
||||||
|
packages = [
|
||||||
|
"unix",
|
||||||
|
"windows"
|
||||||
|
]
|
||||||
|
revision = "3b87a42e500a6dc65dae1a55d0b641295971163e"
|
||||||
|
|
||||||
|
[solve-meta]
|
||||||
|
analyzer-name = "dep"
|
||||||
|
analyzer-version = 1
|
||||||
|
inputs-digest = "f0abeb920368b3b2e50d99f6e5705f0ad6ccd5f7e708f639b6c1fa0820364a22"
|
||||||
|
solver-name = "gps-cdcl"
|
||||||
|
solver-version = 1
|
25
Gopkg.toml
Normal file
25
Gopkg.toml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Gopkg.toml example
|
||||||
|
#
|
||||||
|
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
||||||
|
# for detailed Gopkg.toml documentation.
|
||||||
|
#
|
||||||
|
# required = ["github.com/user/thing/cmd/thing"]
|
||||||
|
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||||
|
#
|
||||||
|
# [[constraint]]
|
||||||
|
# name = "github.com/user/project"
|
||||||
|
# version = "1.0.0"
|
||||||
|
#
|
||||||
|
# [[constraint]]
|
||||||
|
# name = "github.com/user/project2"
|
||||||
|
# branch = "dev"
|
||||||
|
# source = "github.com/myfork/project2"
|
||||||
|
#
|
||||||
|
# [[override]]
|
||||||
|
# name = "github.com/x/y"
|
||||||
|
# version = "2.4.0"
|
||||||
|
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
name = "github.com/sirupsen/logrus"
|
||||||
|
version = "1.0.5"
|
27
Makefile
Normal file
27
Makefile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
all: deps browserpass test
|
||||||
|
|
||||||
|
.PHONY: deps
|
||||||
|
deps:
|
||||||
|
dep ensure
|
||||||
|
|
||||||
|
browserpass: *.go
|
||||||
|
go build -o $@
|
||||||
|
|
||||||
|
browserpass-linux64: *.go
|
||||||
|
env GOOS=linux GOARCH=amd64 go build -o $@
|
||||||
|
|
||||||
|
browserpass-windows64: *.go
|
||||||
|
env GOOS=windows GOARCH=amd64 go build -o $@.exe
|
||||||
|
|
||||||
|
browserpass-darwinx64: *.go
|
||||||
|
env GOOS=darwin GOARCH=amd64 go build -o $@
|
||||||
|
|
||||||
|
browserpass-openbsd64: *.go
|
||||||
|
env GOOS=openbsd GOARCH=amd64 go build -o $@
|
||||||
|
|
||||||
|
browserpass-freebsd64: *.go
|
||||||
|
env GOOS=freebsd GOARCH=amd64 go build -o $@
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
go test
|
32
main.go
Normal file
32
main.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VERSION host app version
|
||||||
|
const VERSION = "3.0.0"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var verbose bool
|
||||||
|
var version bool
|
||||||
|
flag.BoolVar(&verbose, "v", false, "print verbose output")
|
||||||
|
flag.BoolVar(&version, "version", false, "print version and exit")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
|
||||||
|
if verbose {
|
||||||
|
log.SetLevel(log.DebugLevel)
|
||||||
|
}
|
||||||
|
|
||||||
|
if version {
|
||||||
|
log.Info("Browserpass host app version: ", VERSION)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("Starting browserpass host app v%v", VERSION)
|
||||||
|
process()
|
||||||
|
}
|
5
process.go
Normal file
5
process.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func process() {
|
||||||
|
// read stdin, process request, print to stdout...
|
||||||
|
}
|
Reference in New Issue
Block a user