Skip to content

Commit

Permalink
added in atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
antsankov committed Jan 9, 2021
1 parent 90cb072 commit c8b4676
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ COPY --from=builder /go/src/antsankov/go-live/bin/go-live /usr/bin/go-live
RUN chmod +x /usr/bin/go-live

ARG VERSION=none
LABEL version=1.0.0
LABEL version=1.1.0

WORKDIR /workdir

1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ cross-compile:
env GOOS=linux GOARCH=386 go build -o ./release/go-live-linux-x32 -ldflags "-s -w" -trimpath -mod=readonly
env GOOS=linux GOARCH=amd64 go build -o ./release/go-live-linux-x64 -ldflags "-s -w" -trimpath -mod=readonly
env GOOS=darwin GOARCH=amd64 go build -o ./release/go-live-mac-x64 -ldflags "-s -w" -trimpath -mod=readonly
env GOOS=darwin GOARCH=arm64 go build -o ./release/go-live-mac-arm64 -ldflags "-s -w" -trimpath -mod=readonly
env GOOS=windows GOARCH=386 go build -o ./release/go-live-windows-x32.exe -ldflags "-s -w" -trimpath -mod=readonly
env GOOS=windows GOARCH=amd64 go build -o ./release/go-live-windows-x64.exe -ldflags "-s -w" -trimpath -mod=readonly

Expand Down
2 changes: 1 addition & 1 deletion lib/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func Printer(dir string, port string) {
}

printStartMessage(path, port)
var lastIP string = ""
var lastIP string
for {
// Move to the fifth row, change if more print statements are added.
fmt.Print("\033[5;1H")
Expand Down
5 changes: 3 additions & 2 deletions lib/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package lib

import (
"net/http"
"sync/atomic"
"time"
)

var requests uint64 = 0
var requests uint64
var epoch = time.Unix(0, 0).Format(time.RFC1123)
var noCacheHeaders = map[string]string{
"Expires": epoch,
Expand All @@ -23,7 +24,7 @@ var etagHeaders = []string{
}

func incrementRequest() {
requests++
atomic.AddUint64(&requests, 1)
}

// StartServer starts up the file server
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"github.com/pkg/browser"
)

const version = "1.0.0"
// VERSION of Package
const VERSION = "1.1.0"

func main() {
var _quiet bool
Expand All @@ -34,7 +35,7 @@ func main() {
flag.Parse()

if _version {
fmt.Println(version)
fmt.Println(VERSION)
return
}

Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: go-live
version: '1.0.0'
version: '1.1.0'
summary: A very lightweight CLI utility to start serving a file directory
description: |
go-live can be used for local web development, production static-site serving, or as a network file server. By default go-live serves the directory it is executed in.
Expand Down

0 comments on commit c8b4676

Please sign in to comment.