Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aibotsoft committed Mar 17, 2020
1 parent 97e983c commit 065b62e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
APP_NAME=service-kit
DOCKER_USERNAME=aibotsoft
CGO_ENABLED=0
#GOOS=linux
GOARCH=amd64

linux_build:
Expand All @@ -15,11 +14,12 @@ run:
go run main.go

test:
go test ./...
go test -v -cover ./...

run_build:
dist/service

#Команды для докера
docker_build:
docker image build -f Dockerfile -t $$DOCKER_USERNAME/$$APP_NAME .

Expand Down
15 changes: 15 additions & 0 deletions internal/metrics/metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package metrics

//
//import (
// "fmt"
// "net/http"
//)
//
//
//http.HandleFunc("/bench", benchHandler)
//func benchHandler(w http.ResponseWriter, _ *http.Request) {
// w.Header().Set("Connection", "keep-alive")
// w.Header().Set("Content-Type", "text/plain")
// _, _ = fmt.Fprint(w, "1")
//}
24 changes: 19 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package main

import (
"fmt"
"github.com/aibotsoft/service-kit/internal/config"
"github.com/aibotsoft/service-kit/internal/logging"
"time"
"net/http"
"os"
"os/signal"
"syscall"
)

func main() {
Expand All @@ -15,8 +19,18 @@ func main() {
log.Println("Beginning...")
log.Println("Config: ", cfg)

for {
log.Println(time.Now().UTC())
time.Sleep(2 * time.Second)
}
//for {
// log.Println(time.Now().UTC())
// time.Sleep(2 * time.Second)
//}

errs := make(chan error)
go func() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
errs <- fmt.Errorf("%s", <-c)
}()

log.Fatal(http.ListenAndServe(":80", nil))
//http.ListenAndServe()
}

0 comments on commit 065b62e

Please sign in to comment.