From bb91e438a8d5db2f0b01e6c318881b37226b2de1 Mon Sep 17 00:00:00 2001 From: Ciprian Dorin Craciun Date: Sun, 11 Nov 2018 18:44:30 +0200 Subject: [PATCH] [sources] Re-structure sources so that the HTTP server does not depend on brotli --- .x-run | 17 +++++++++++++++-- sources/cmd/archiver.go | 3 ++- sources/cmd/server.go | 3 ++- sources/lib/{ => archiver}/compress.go | 2 +- sources/lib/{ => common}/errors.go | 2 +- sources/lib/{ => common}/main.go | 2 +- sources/lib/{ => common}/metadata.go | 2 +- sources/lib/{ => common}/mime.go | 2 +- sources/lib/{ => common}/namespaces.go | 2 +- sources/lib/{ => server}/favicon.go | 2 +- 10 files changed, 26 insertions(+), 11 deletions(-) rename sources/lib/{ => archiver}/compress.go (98%) rename sources/lib/{ => common}/errors.go (98%) rename sources/lib/{ => common}/main.go (98%) rename sources/lib/{ => common}/metadata.go (98%) rename sources/lib/{ => common}/mime.go (98%) rename sources/lib/{ => common}/namespaces.go (94%) rename sources/lib/{ => server}/favicon.go (99%) diff --git a/.x-run b/.x-run index 3065dc4..542e515 100644 --- a/.x-run +++ b/.x-run @@ -119,6 +119,21 @@ +<< go / build / debug + "${X_RUN}" ':: go / build / archiver / debug' "${@}" + "${X_RUN}" ':: go / build / server / debug' "${@}" + exit -- 0 +!! + +<< go / build / release + "${X_RUN}" ':: go / build / archiver / release' "${@}" + "${X_RUN}" ':: go / build / server / release' "${@}" + exit -- 0 +!! + + + + << publish test "${#}" -eq 0 printf -- '[ii] publishing to `https://data.volution.ro/ciprian/ad5264afc6e27e46b5d71837552cb3fd`...\n' >&2 @@ -129,8 +144,6 @@ - - << go / dependencies / update test "${#}" -eq 0 exec -- "${X_RUN[@]}" ':: go / tool' get -v -d -- ./sources/... diff --git a/sources/cmd/archiver.go b/sources/cmd/archiver.go index a825890..f478a02 100644 --- a/sources/cmd/archiver.go +++ b/sources/cmd/archiver.go @@ -19,7 +19,8 @@ import "sort" // import "github.com/colinmarc/cdb" import cdb "github.com/cipriancraciun/go-cdb-lib" -import . "../lib" +import . "../lib/common" +import . "../lib/archiver" diff --git a/sources/cmd/server.go b/sources/cmd/server.go index f279c18..048f90e 100644 --- a/sources/cmd/server.go +++ b/sources/cmd/server.go @@ -17,7 +17,8 @@ import "time" // import "github.com/colinmarc/cdb" import cdb "github.com/cipriancraciun/go-cdb-lib" -import . "../lib" +import . "../lib/common" +import . "../lib/server" diff --git a/sources/lib/compress.go b/sources/lib/archiver/compress.go similarity index 98% rename from sources/lib/compress.go rename to sources/lib/archiver/compress.go index 54e0760..c0fb25c 100644 --- a/sources/lib/compress.go +++ b/sources/lib/archiver/compress.go @@ -1,6 +1,6 @@ -package lib +package archiver import "bytes" diff --git a/sources/lib/errors.go b/sources/lib/common/errors.go similarity index 98% rename from sources/lib/errors.go rename to sources/lib/common/errors.go index dadd7f4..8dfceed 100644 --- a/sources/lib/errors.go +++ b/sources/lib/common/errors.go @@ -1,6 +1,6 @@ -package lib +package common import "log" diff --git a/sources/lib/main.go b/sources/lib/common/main.go similarity index 98% rename from sources/lib/main.go rename to sources/lib/common/main.go index 9f3ec6c..5dac933 100644 --- a/sources/lib/main.go +++ b/sources/lib/common/main.go @@ -1,6 +1,6 @@ -package lib +package common import "flag" diff --git a/sources/lib/metadata.go b/sources/lib/common/metadata.go similarity index 98% rename from sources/lib/metadata.go rename to sources/lib/common/metadata.go index 4c91d1f..ab79ca1 100644 --- a/sources/lib/metadata.go +++ b/sources/lib/common/metadata.go @@ -1,6 +1,6 @@ -package lib +package common import "bytes" diff --git a/sources/lib/mime.go b/sources/lib/common/mime.go similarity index 98% rename from sources/lib/mime.go rename to sources/lib/common/mime.go index c3bea2d..0745613 100644 --- a/sources/lib/mime.go +++ b/sources/lib/common/mime.go @@ -1,6 +1,6 @@ -package lib +package common diff --git a/sources/lib/namespaces.go b/sources/lib/common/namespaces.go similarity index 94% rename from sources/lib/namespaces.go rename to sources/lib/common/namespaces.go index 7c636e5..33c9453 100644 --- a/sources/lib/namespaces.go +++ b/sources/lib/common/namespaces.go @@ -1,6 +1,6 @@ -package lib +package common diff --git a/sources/lib/favicon.go b/sources/lib/server/favicon.go similarity index 99% rename from sources/lib/favicon.go rename to sources/lib/server/favicon.go index bdeef18..c53bca7 100644 --- a/sources/lib/favicon.go +++ b/sources/lib/server/favicon.go @@ -1,6 +1,6 @@ -package lib +package server import "encoding/base64"