-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
logging update, remove unnecessary function, security fixes, update b…
…uild, update readme Signed-off-by: Brian Downs <[email protected]>
- Loading branch information
1 parent
f629acf
commit fa151df
Showing
1,262 changed files
with
266 additions
and
645,350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,46 @@ | ||
LDFLAGS = -ldflags "-X main.gitSHA=$(shell git rev-parse HEAD)" | ||
GO = go | ||
|
||
BINDIR := bin | ||
BINARY := simple-httpd | ||
PREFIX := /usr/local | ||
|
||
VERSION = 0.3.0 | ||
GIT_SHA = $(shell git rev-parse HEAD) | ||
LDFLAGS = -ldflags "-X main.gitSHA=$(GIT_SHA) -X main.version=$(VERSION) -X main.name=$(BINARY)" | ||
|
||
OS := $(shell uname) | ||
|
||
.PHONY: build | ||
build: clean | ||
go build $(LDFLAGS) -o simple-httpd | ||
$(BINDIR)/$(BINARY): clean | ||
$(GO) build $(LDFLAGS) -o $@ | ||
|
||
.PHONY: test | ||
test: | ||
go test -v . | ||
$(GO) test -v . | ||
|
||
.PHONY: clean | ||
clean: | ||
go clean | ||
rm -f simple-httpd | ||
rm -f bin/* | ||
$(GO) clean | ||
rm -f $(BINARY) | ||
rm -f $(BINDIR)/* | ||
|
||
.PHONY: install | ||
install: clean | ||
ifeq ($(OS),Darwin) | ||
./build.sh darwin | ||
cp -f bin/simple-httpd-darwin /usr/local/bin/simple-httpd | ||
./build.sh darwin $(BINARY) $(VERSION) $(GIT_SHA) | ||
cp -f $(BINDIR)/$(BINARY)-darwin $(PREFIX)/$(BINDIR)/$(BINARY) | ||
endif | ||
ifeq ($(OS),Linux) | ||
./build.sh linux | ||
cp -f bin/simple-httpd-linux /usr/local/bin/simple-httpd | ||
./build.sh linux $(BINARY) $(VERSION) $(GIT_SHA) | ||
cp -f $(BINDIR)/$(BINARY)-linux $(PREFIX)/$(BINDIR)/$(BINARY) | ||
endif | ||
ifeq ($(OS),FreeBSD) | ||
./build.sh freebsd | ||
cp -f bin/simple-httpd-freebsd /usr/local/bin/simple-httpd | ||
./build.sh freebsd $(BINARY) $(VERSION) $(GIT_SHA) | ||
cp -f $(BINDIR)/$(BINARY)-freebsd $(PREFIX)/$(BINDIR)/$(BINARY) | ||
endif | ||
uninstall: | ||
rm -f /usr/local/bin/simple-httpd* | ||
rm -f $(PREFIX)/$(BINDIR)/$(BINARY)* | ||
|
||
.PHONY: release | ||
release: | ||
./build.sh release | ||
release: clean | ||
./build.sh release $(BINARY) $(VERSION) $(GIT_SHA) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,46 @@ | ||
#!/bin/sh | ||
|
||
VERSION="0.3" | ||
ARCHS="darwin linux freebsd windows" | ||
OSs="darwin linux freebsd windows" | ||
ARCHs="arm64 amd64" | ||
|
||
if [ -z $1 ]; then | ||
echo "error: requires argument of [release|freebsd|darwin|linux|windows]" | ||
exit 1 | ||
fi | ||
OS=$1 | ||
|
||
if [ $1 == "release" ]; then | ||
echo "Generating simple-httpd release binaries..." | ||
for arch in ${ARCHS}; do | ||
GOOS=${arch} GOARCH=amd64 go build -v -ldflags "-X main.gitSHA=$(git rev-parse HEAD)" -o bin/simple-httpd-${arch} | ||
done | ||
if [ -z $2 ]; then | ||
echo "error: requires argument of <bin name>" | ||
exit 1 | ||
fi | ||
BINARY=$2 | ||
|
||
if [ -z $3 ]; then | ||
echo "error: requires argument of <semver>" | ||
exit 1 | ||
fi | ||
VERSION=$3 | ||
|
||
case "$1" in | ||
"release") | ||
echo "Building release..." | ||
for arch in ${ARCHS}; do | ||
GOOS=${arch} GOARCH=amd64 go build -v -ldflags "-X main.gitSHA=$(git rev-parse HEAD)" -o bin/simple-httpd-${arch} | ||
tar -czvf bin/simple-httpd-${arch}.tar.gz bin/simple-httpd-${arch} | ||
if [ -z $4 ]; then | ||
echo "error: requires argument of <git sha>" | ||
exit 1 | ||
fi | ||
|
||
GIT_SHA=$4 | ||
|
||
if [ ${OS} == "release" ]; then | ||
echo "Generating ${BINARY} release binaries..." | ||
for os in ${OSs}; do | ||
for arch in ${ARCHs}; do | ||
if [ ${arch} = "arm64" ] && [ ${os} = "windows" ]; then | ||
continue | ||
fi | ||
if [ ${arch} = "arm64" ] && [ ${os} = "darwin" ]; then | ||
continue | ||
fi | ||
GOOS=${os} GOARCH=${arch} go build -v -ldflags "-X main.gitSHA=${GIT_SHA} -X main.version=${VERSION} -X main.name=${BINARY}" -o bin/${BINARY}-${os}-${arch} | ||
done | ||
;; | ||
"freebsd") | ||
echo "Building binary for FreeBSD..." | ||
GOOS=freebsd GOARCH=amd64 go build -v -ldflags "-X main.gitSHA=$(git rev-parse HEAD)" -o bin/simple-httpd-freebsd | ||
;; | ||
"darwin") | ||
echo "Building binary for Darwin..." | ||
GOOS=darwin GOARCH=amd64 go build -v -ldflags "-X main.gitSHA=$(git rev-parse HEAD)" -o bin/simple-httpd-darwin | ||
;; | ||
"linux") | ||
echo "Building binary for Linux..." | ||
GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.gitSHA=$(git rev-parse HEAD)" -o bin/simple-httpd-linux | ||
;; | ||
"windows") | ||
echo "Building binary for Windows..." | ||
GOOS=windows GOARCH=amd64 go build -v -ldflags "-X main.gitSHA=$(git rev-parse HEAD)" -o bin/simple-httpd-windows.exe | ||
;; | ||
esac | ||
done | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
module github.com/briandowns/simple-httpd | ||
|
||
go 1.13 | ||
go 1.15 | ||
|
||
require ( | ||
golang.org/x/crypto v0.0.0-20170606163016-e7ba82683099 | ||
golang.org/x/net v0.0.0-20170610001149-1a68b1313cf4 | ||
golang.org/x/text v0.0.0-20170609090223-210eee5cf732 | ||
go.uber.org/zap v1.16.0 | ||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,49 @@ | ||
golang.org/x/crypto v0.0.0-20170606163016-e7ba82683099 h1:I4qkV9tPncVkQYMfrPH2Puyw2/JzngpFdj4yRu95AgM= | ||
golang.org/x/crypto v0.0.0-20170606163016-e7ba82683099/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | ||
golang.org/x/net v0.0.0-20170610001149-1a68b1313cf4/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||
golang.org/x/text v0.0.0-20170609090223-210eee5cf732/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= | ||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= | ||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | ||
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= | ||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= | ||
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= | ||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= | ||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= | ||
go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= | ||
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= | ||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= | ||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= | ||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= | ||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= | ||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= | ||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= | ||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= | ||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= | ||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | ||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | ||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | ||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= | ||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= |
Oops, something went wrong.