Skip to content

Commit

Permalink
feat!: bump to go1.16 and embed version
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed May 8, 2021
1 parent 6a99cdf commit 6f15589
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 292 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Expand Up @@ -12,15 +12,15 @@ COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN ./_do_gen_assets
RUN ./_do_build_server
RUN GOOS=linux go build -o gonic cmd/gonic/gonic.go

FROM alpine:3.13.1
RUN apk add -U --no-cache \
ffmpeg \
ca-certificates \
tzdata \
tini

COPY --from=builder \
/usr/lib/libgcc_s.so.1 \
/usr/lib/libstdc++.so.6 \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.debug
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:experimental

FROM golang:1.14-alpine AS builder
FROM golang:1.16-alpine AS builder
RUN apk add -U --no-cache \
build-base \
ca-certificates \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:experimental

FROM golang:1.15-alpine AS builder
FROM golang:1.16-alpine AS builder
RUN apk add -U --no-cache \
build-base \
ca-certificates \
Expand Down
7 changes: 0 additions & 7 deletions TODO

This file was deleted.

4 changes: 0 additions & 4 deletions _do_build_server

This file was deleted.

69 changes: 0 additions & 69 deletions _do_bump_version

This file was deleted.

20 changes: 0 additions & 20 deletions _do_gen_assets

This file was deleted.

4 changes: 0 additions & 4 deletions _do_run_server

This file was deleted.

9 changes: 0 additions & 9 deletions _do_run_server_live

This file was deleted.

15 changes: 9 additions & 6 deletions cmd/gonic/main.go → cmd/gonic/gonic.go
Expand Up @@ -15,9 +15,9 @@ import (
"github.com/oklog/run"
"github.com/peterbourgon/ff"

"go.senan.xyz/gonic"
"go.senan.xyz/gonic/server"
"go.senan.xyz/gonic/server/db"
"go.senan.xyz/gonic/version"
)

const (
Expand All @@ -27,7 +27,7 @@ const (
)

func main() {
set := flag.NewFlagSet(version.NAME, flag.ExitOnError)
set := flag.NewFlagSet(gonic.Version, flag.ExitOnError)
confListenAddr := set.String("listen-addr", "0.0.0.0:4747", "listen address (optional)")
confMusicPath := set.String("music-path", "", "path to music")
confPodcastPath := set.String("podcast-path", "", "path to podcasts")
Expand All @@ -44,17 +44,17 @@ func main() {
if err := ff.Parse(set, os.Args[1:],
ff.WithConfigFileFlag("config-path"),
ff.WithConfigFileParser(ff.PlainParser),
ff.WithEnvVarPrefix(version.NAME_UPPER),
ff.WithEnvVarPrefix(gonic.NameUpper),
); err != nil {
log.Fatalf("error parsing args: %v\n", err)
}

if *confShowVersion {
fmt.Println(version.VERSION)
fmt.Println(gonic.Version)
os.Exit(0)
}

log.Printf("starting gonic %s\n", version.VERSION)
log.Printf("starting gonic %s\n", gonic.Version)
log.Printf("provided config\n")
set.VisitAll(func(f *flag.Flag) {
log.Printf(" %-15s %s\n", f.Name, f.Value)
Expand Down Expand Up @@ -92,7 +92,7 @@ func main() {

proxyPrefixExpr := regexp.MustCompile(`^\/*(.*?)\/*$`)
*confProxyPrefix = proxyPrefixExpr.ReplaceAllString(*confProxyPrefix, `/$1`)
server := server.New(server.Options{
server, err := server.New(server.Options{
DB: db,
MusicPath: *confMusicPath,
CachePath: cacheDirAudio,
Expand All @@ -103,6 +103,9 @@ func main() {
HTTPLog: *confHTTPLog,
JukeboxEnabled: *confJukeboxEnabled,
})
if err != nil {
log.Fatalf("error creating server: %v\n", err)
}

var g run.Group
g.Add(server.StartHTTP(*confListenAddr))
Expand Down
156 changes: 0 additions & 156 deletions cmd/gonicembed/main.go

This file was deleted.

2 changes: 1 addition & 1 deletion _do_gen_handler_tests → gen_handler_tests
Expand Up @@ -10,7 +10,7 @@ test_cache_path="$(mktemp -d)"

mkdir "$test_music_path" 2>/dev/null
echo "waiting for server to start"
./_do_run_server \
go run cmd/gonic/gonic.go \
-music-path "$test_music_path" \
-podcast-path "$test_podcast_path" \
-cache-path "$test_cache_path" \
Expand Down
4 changes: 2 additions & 2 deletions go.mod
@@ -1,5 +1,7 @@
module go.senan.xyz/gonic

go 1.16

require (
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
Expand Down Expand Up @@ -39,5 +41,3 @@ require (
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/gormigrate.v1 v1.6.0
)

go 1.15

0 comments on commit 6f15589

Please sign in to comment.