packageized
This commit is contained in:
parent
c0987f06e6
commit
f98f22d9cc
8
Makefile
8
Makefile
@ -38,8 +38,8 @@ clean:
|
|||||||
|
|
||||||
build: ./$(FN)
|
build: ./$(FN)
|
||||||
|
|
||||||
./$(FN): *.go
|
./$(FN): *.go cmd/*/*.go
|
||||||
go build -o $@ $(GOFLAGS) .
|
cd cmd/$(FN) && go build -o ../../$(FN) $(GOFLAGS) .
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
go fmt *.go
|
go fmt *.go
|
||||||
@ -49,7 +49,7 @@ test: build-docker-image
|
|||||||
is_uncommitted:
|
is_uncommitted:
|
||||||
git diff --exit-code >/dev/null 2>&1
|
git diff --exit-code >/dev/null 2>&1
|
||||||
|
|
||||||
build-docker-image: is_uncommitted
|
build-docker-image: is_uncommitted clean
|
||||||
docker build -t $(IMAGENAME):$(VERSION) -t $(IMAGENAME):latest -t $(IMAGENAME):$(BUILDTIMETAG) .
|
docker build -t $(IMAGENAME):$(VERSION) -t $(IMAGENAME):latest -t $(IMAGENAME):$(BUILDTIMETAG) .
|
||||||
|
|
||||||
dist: build-docker-image
|
dist: build-docker-image
|
||||||
@ -63,3 +63,5 @@ upload-docker-image: build-docker-image
|
|||||||
docker push $(IMAGENAME):$(VERSION)
|
docker push $(IMAGENAME):$(VERSION)
|
||||||
docker push $(IMAGENAME):$(BUILDTIMETAG)
|
docker push $(IMAGENAME):$(BUILDTIMETAG)
|
||||||
docker push $(IMAGENAME):latest
|
docker push $(IMAGENAME):latest
|
||||||
|
|
||||||
|
.PHONY: build fmt test is_uncommitted build-docker-image dist hub upload-docker-image clean run rundebug default
|
||||||
|
4
api.go
4
api.go
@ -13,6 +13,10 @@ type TootArchiverAPIServer struct {
|
|||||||
archiver *TootArchiver
|
archiver *TootArchiver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *TootArchiverAPIServer) SetArchiver(archiver *TootArchiver) {
|
||||||
|
self.archiver = archiver
|
||||||
|
}
|
||||||
|
|
||||||
func (a *TootArchiverAPIServer) Serve() {
|
func (a *TootArchiverAPIServer) Serve() {
|
||||||
if a.archiver == nil {
|
if a.archiver == nil {
|
||||||
panic("must have archiver from which to serve stats")
|
panic("must have archiver from which to serve stats")
|
||||||
|
@ -8,6 +8,8 @@ import "github.com/rs/zerolog"
|
|||||||
import "github.com/rs/zerolog/log"
|
import "github.com/rs/zerolog/log"
|
||||||
import "golang.org/x/crypto/ssh/terminal"
|
import "golang.org/x/crypto/ssh/terminal"
|
||||||
|
|
||||||
|
import "github.com/sneak/feta"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
os.Exit(app())
|
os.Exit(app())
|
||||||
}
|
}
|
||||||
@ -30,10 +32,10 @@ func app() int {
|
|||||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
archiver := NewTootArchiver()
|
archiver := feta.NewTootArchiver()
|
||||||
|
|
||||||
api := new(TootArchiverAPIServer)
|
api := new(feta.TootArchiverAPIServer)
|
||||||
api.archiver = archiver
|
api.SetArchiver(archiver)
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user