move to text logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-12-07 16:21:00 +03:00
parent c5f3fa325e
commit 07f67fd1d7
6 changed files with 13 additions and 28 deletions

View File

@ -8,6 +8,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"io" "io"
stdslog "log/slog"
"net/http" "net/http"
"os" "os"
"os/exec" "os/exec"
@ -97,7 +98,7 @@ func main() {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
log := slog.NewLogger() log := slog.NewLogger(slog.WithHandlerFunc(stdslog.NewTextHandler))
if err = log.Init(logger.WithLevel(logger.DebugLevel)); err != nil { if err = log.Init(logger.WithLevel(logger.DebugLevel)); err != nil {
log.Error(ctx, fmt.Sprintf("logger init error: %v", err)) log.Error(ctx, fmt.Sprintf("logger init error: %v", err))

8
go.mod
View File

@ -5,7 +5,6 @@ go 1.22.7
toolchain go1.23.3 toolchain go1.23.3
require ( require (
git.unistack.org/unistack-org/pkgdash v0.0.0-20240421141944-8729d0b88e60
github.com/envoyproxy/protoc-gen-validate v1.1.0 github.com/envoyproxy/protoc-gen-validate v1.1.0
github.com/go-git/go-git/v5 v5.12.0 github.com/go-git/go-git/v5 v5.12.0
github.com/golang-migrate/migrate/v4 v4.17.0 github.com/golang-migrate/migrate/v4 v4.17.0
@ -26,7 +25,7 @@ require (
go.unistack.org/micro-meter-victoriametrics/v3 v3.8.9 go.unistack.org/micro-meter-victoriametrics/v3 v3.8.9
go.unistack.org/micro-proto/v3 v3.4.1 go.unistack.org/micro-proto/v3 v3.4.1
go.unistack.org/micro-server-http/v3 v3.11.37 go.unistack.org/micro-server-http/v3 v3.11.37
go.unistack.org/micro/v3 v3.11.1 go.unistack.org/micro/v3 v3.11.12
go.unistack.org/protoc-gen-go-micro/v3 v3.10.10 go.unistack.org/protoc-gen-go-micro/v3 v3.10.10
golang.org/x/mod v0.17.0 golang.org/x/mod v0.17.0
golang.org/x/sync v0.9.0 golang.org/x/sync v0.9.0
@ -54,9 +53,6 @@ require (
github.com/sirupsen/logrus v1.9.2 // indirect github.com/sirupsen/logrus v1.9.2 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect
go.unistack.org/metrics v0.0.1 // indirect go.unistack.org/metrics v0.0.1 // indirect
go.unistack.org/micro-client-http/v4 v4.0.3 // indirect
go.unistack.org/micro/v4 v4.0.19 // indirect
go.unistack.org/protoc-gen-go-micro/v4 v4.0.13 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/grpc v1.68.0 // indirect google.golang.org/grpc v1.68.0 // indirect
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
@ -112,8 +108,6 @@ require (
github.com/valyala/histogram v1.2.0 // indirect github.com/valyala/histogram v1.2.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/atomic v1.11.0 // indirect go.uber.org/atomic v1.11.0 // indirect
go.unistack.org/micro-proto/v4 v4.1.0 // indirect
go.unistack.org/micro-server-http/v4 v4.0.14 // indirect
golang.org/x/crypto v0.29.0 // indirect golang.org/x/crypto v0.29.0 // indirect
golang.org/x/net v0.31.0 // indirect golang.org/x/net v0.31.0 // indirect
golang.org/x/sys v0.27.0 // indirect golang.org/x/sys v0.27.0 // indirect

16
go.sum
View File

@ -598,8 +598,6 @@ dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc=
git.unistack.org/unistack-org/pkgdash v0.0.0-20240421141944-8729d0b88e60 h1:krDhRxIidcH9cHDVDknzX63apkX5n6vMVPsVVvqwJ9M=
git.unistack.org/unistack-org/pkgdash v0.0.0-20240421141944-8729d0b88e60/go.mod h1:fvjlwL8DWv+t/NbOiLgVZ/++txVBzB7dN/4CouqMqJU=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
@ -1169,8 +1167,6 @@ go.unistack.org/metrics v0.0.1 h1:sCnGO059ZccGC/D34iRH121eSk+7ci5+OY9cl5K7GKY=
go.unistack.org/metrics v0.0.1/go.mod h1:1FY4R7EKJa9Oz2D6wlGScNerpl6igRs9Cx/3et4Rgs4= go.unistack.org/metrics v0.0.1/go.mod h1:1FY4R7EKJa9Oz2D6wlGScNerpl6igRs9Cx/3et4Rgs4=
go.unistack.org/micro-client-http/v3 v3.9.14 h1:26BiMcUlGpxpN+S84tpAeMetbd9rbBd+IILq1CkFP2U= go.unistack.org/micro-client-http/v3 v3.9.14 h1:26BiMcUlGpxpN+S84tpAeMetbd9rbBd+IILq1CkFP2U=
go.unistack.org/micro-client-http/v3 v3.9.14/go.mod h1:KS6qxpxGDQmcszBaJpidc1KOr528QflEKoGopl0qYJ8= go.unistack.org/micro-client-http/v3 v3.9.14/go.mod h1:KS6qxpxGDQmcszBaJpidc1KOr528QflEKoGopl0qYJ8=
go.unistack.org/micro-client-http/v4 v4.0.3 h1:QaF1X7+cGp+oCtilU5v6q3tLD2+y7IdgQw9noMT6NUs=
go.unistack.org/micro-client-http/v4 v4.0.3/go.mod h1:KL8D4Cmo7NC/tWNWxcmqiMFHiv1jpl+5e5jQ85Xmi78=
go.unistack.org/micro-codec-json/v3 v3.10.1 h1:FzmWTfoE2JlzU4EyNqQcsE2bbSOgUKEyNc+GE3aFl9E= go.unistack.org/micro-codec-json/v3 v3.10.1 h1:FzmWTfoE2JlzU4EyNqQcsE2bbSOgUKEyNc+GE3aFl9E=
go.unistack.org/micro-codec-json/v3 v3.10.1/go.mod h1:+SrHzfCaC1bTqY5gUC387nZywS15tSk+GcuJ09KUt0U= go.unistack.org/micro-codec-json/v3 v3.10.1/go.mod h1:+SrHzfCaC1bTqY5gUC387nZywS15tSk+GcuJ09KUt0U=
go.unistack.org/micro-codec-jsonpb/v3 v3.10.3 h1:4GTNrhpwPCRqSuimlOdgViE+95IE4YeBNeOCTawSTeM= go.unistack.org/micro-codec-jsonpb/v3 v3.10.3 h1:4GTNrhpwPCRqSuimlOdgViE+95IE4YeBNeOCTawSTeM=
@ -1190,21 +1186,13 @@ go.unistack.org/micro-meter-victoriametrics/v3 v3.8.9/go.mod h1:xODJQ0Nu/F8k34D/
go.unistack.org/micro-proto/v3 v3.3.1/go.mod h1:cwRyv8uInM2I7EbU7O8Fx2Ls3N90Uw9UCCcq4olOdfE= go.unistack.org/micro-proto/v3 v3.3.1/go.mod h1:cwRyv8uInM2I7EbU7O8Fx2Ls3N90Uw9UCCcq4olOdfE=
go.unistack.org/micro-proto/v3 v3.4.1 h1:UTjLSRz2YZuaHk9iSlVqqsA50JQNAEK2ZFboGqtEa9Q= go.unistack.org/micro-proto/v3 v3.4.1 h1:UTjLSRz2YZuaHk9iSlVqqsA50JQNAEK2ZFboGqtEa9Q=
go.unistack.org/micro-proto/v3 v3.4.1/go.mod h1:okx/cnOhzuCX0ggl/vToatbCupi0O44diiiLLsZ93Zo= go.unistack.org/micro-proto/v3 v3.4.1/go.mod h1:okx/cnOhzuCX0ggl/vToatbCupi0O44diiiLLsZ93Zo=
go.unistack.org/micro-proto/v4 v4.1.0 h1:qPwL2n/oqh9RE3RTTDgt28XK3QzV597VugQPaw9lKUk=
go.unistack.org/micro-proto/v4 v4.1.0/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec=
go.unistack.org/micro-server-http/v3 v3.11.37 h1:6U1VYm1UveAdc8+ld2d3gcROiVkKC5oAtKopYWZHvrg= go.unistack.org/micro-server-http/v3 v3.11.37 h1:6U1VYm1UveAdc8+ld2d3gcROiVkKC5oAtKopYWZHvrg=
go.unistack.org/micro-server-http/v3 v3.11.37/go.mod h1:WArpH0UJdjToCajyW/y10ozfBJ7sThJAvmzXF3KJWjI= go.unistack.org/micro-server-http/v3 v3.11.37/go.mod h1:WArpH0UJdjToCajyW/y10ozfBJ7sThJAvmzXF3KJWjI=
go.unistack.org/micro-server-http/v4 v4.0.14 h1:PisuwdAzLAEo9j+otmSYXxl22VpKqMgNeiSUHCcqv2c=
go.unistack.org/micro-server-http/v4 v4.0.14/go.mod h1:ilh+n9Oju5JdiBPeSKMCQVEsXgjfhg8Br1M17VRfGVI=
go.unistack.org/micro/v3 v3.10.94/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg= go.unistack.org/micro/v3 v3.10.94/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
go.unistack.org/micro/v3 v3.11.1 h1:znLqVnMnZl1qAS3QqYg7wBdOVVUAha0xBRNpPSNZ/0M= go.unistack.org/micro/v3 v3.11.12 h1:EKcEpU3oNnpOzwaOaM5X4kPSz3BbbqEtiKS4+OENBcE=
go.unistack.org/micro/v3 v3.11.1/go.mod h1:YzMldzHN9Ei+zy5t/Psu7RUWDZwUfrNYiStSQtTz90g= go.unistack.org/micro/v3 v3.11.12/go.mod h1:YzMldzHN9Ei+zy5t/Psu7RUWDZwUfrNYiStSQtTz90g=
go.unistack.org/micro/v4 v4.0.19 h1:TrOJ+j0D1ZHwLEDUabei4ciLzJh/StDWiw4FQBCstY8=
go.unistack.org/micro/v4 v4.0.19/go.mod h1:5+da5r835gP0WnNZbYUJDCvWpJ9Xc3IEGyp62e8o8R4=
go.unistack.org/protoc-gen-go-micro/v3 v3.10.10 h1:FFl0Nnj/J3XjJtRgqE7fPYCmTw35r9TTDtfxiZFD5cA= go.unistack.org/protoc-gen-go-micro/v3 v3.10.10 h1:FFl0Nnj/J3XjJtRgqE7fPYCmTw35r9TTDtfxiZFD5cA=
go.unistack.org/protoc-gen-go-micro/v3 v3.10.10/go.mod h1:4QtigOBK8E46G7zcSw9EBnhT/39nme5WNJk1U3bpgcI= go.unistack.org/protoc-gen-go-micro/v3 v3.10.10/go.mod h1:4QtigOBK8E46G7zcSw9EBnhT/39nme5WNJk1U3bpgcI=
go.unistack.org/protoc-gen-go-micro/v4 v4.0.13 h1:7iqOK75ErgGJK6c7SjL7rDy9DBv2IjSFw2OZx5waUo8=
go.unistack.org/protoc-gen-go-micro/v4 v4.0.13/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=

View File

@ -3,10 +3,11 @@ package coverage
import ( import (
"context" "context"
"fmt" "fmt"
"git.unistack.org/unistack-org/pkgdash/internal/models"
"golang.org/x/tools/cover"
"io" "io"
"strings" "strings"
"go.unistack.org/pkgdash/internal/models"
"golang.org/x/tools/cover"
) )
func Analyze(ctx context.Context, dataCoverage io.Reader, pack models.Package) (float64, error) { func Analyze(ctx context.Context, dataCoverage io.Reader, pack models.Package) (float64, error) {
@ -43,7 +44,7 @@ func Analyze(ctx context.Context, dataCoverage io.Reader, pack models.Package) (
fmt.Printf("add new keys, was: %d, has: %d", cur, len(mapCover)) fmt.Printf("add new keys, was: %d, has: %d", cur, len(mapCover))
} }
//TODO add calculate full // TODO add calculate full
return 0, nil return 0, nil
} }

View File

@ -2,10 +2,11 @@ package coverage
import ( import (
"context" "context"
"git.unistack.org/unistack-org/pkgdash/internal/models"
"github.com/stretchr/testify/assert"
"os" "os"
"testing" "testing"
"github.com/stretchr/testify/assert"
"go.unistack.org/pkgdash/internal/models"
) )
func Test_Calculate(t *testing.T) { func Test_Calculate(t *testing.T) {

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"git.unistack.org/unistack-org/pkgdash/internal/models" "go.unistack.org/pkgdash/internal/models"
) )
func TestGenerate(t *testing.T) { func TestGenerate(t *testing.T) {