[#68] Makefile: Use gofumpt for formatting
All checks were successful
DCO action / DCO (pull_request) Successful in 1m17s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m22s
Tests and linters / Lint (pull_request) Successful in 2m51s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m48s
Tests and linters / Tests with -race (pull_request) Successful in 2m40s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m17s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m22s
Tests and linters / Lint (pull_request) Successful in 2m51s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m48s
Tests and linters / Tests with -race (pull_request) Successful in 2m40s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
ea6e390c7b
commit
a85146250b
9 changed files with 36 additions and 28 deletions
|
@ -18,6 +18,15 @@ repos:
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
exclude: ".key$"
|
exclude: ".key$"
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: gofumpt
|
||||||
|
name: gofumpt
|
||||||
|
entry: make fumpt
|
||||||
|
pass_filenames: false
|
||||||
|
types: [go]
|
||||||
|
language: system
|
||||||
|
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: go-unit-tests
|
- id: go-unit-tests
|
||||||
|
|
16
Makefile
16
Makefile
|
@ -3,7 +3,7 @@ SHELL = bash
|
||||||
|
|
||||||
VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always)
|
VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 --dirty --always)
|
||||||
|
|
||||||
.PHONY: dep fmts fmt imports protoc test lint version help
|
.PHONY: dep fmts fumpt imports protoc test lint version help
|
||||||
|
|
||||||
# Pull go dependencies
|
# Pull go dependencies
|
||||||
dep:
|
dep:
|
||||||
|
@ -18,14 +18,7 @@ dep:
|
||||||
go test ./... && echo OK
|
go test ./... && echo OK
|
||||||
|
|
||||||
# Run all code formatters
|
# Run all code formatters
|
||||||
fmts: fmt imports
|
fmts: fumpt imports
|
||||||
|
|
||||||
# Reformat code
|
|
||||||
fmt:
|
|
||||||
@echo "⇒ Processing gofmt check"
|
|
||||||
@for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \
|
|
||||||
gofmt -s -w $$f; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# Reformat imports
|
# Reformat imports
|
||||||
imports:
|
imports:
|
||||||
|
@ -34,6 +27,11 @@ imports:
|
||||||
goimports -w $$f; \
|
goimports -w $$f; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Run gofumpt
|
||||||
|
fumpt:
|
||||||
|
@echo "⇒ Processing gofumpt check"
|
||||||
|
@gofumpt -l -w .
|
||||||
|
|
||||||
# Regenerate code for proto files
|
# Regenerate code for proto files
|
||||||
protoc:
|
protoc:
|
||||||
@GOPRIVATE=github.com/TrueCloudLab go mod vendor
|
@GOPRIVATE=github.com/TrueCloudLab go mod vendor
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
func TestSetNotification(t *testing.T) {
|
func TestSetNotification(t *testing.T) {
|
||||||
o := new(Object)
|
o := new(Object)
|
||||||
|
|
||||||
var ni = NotificationInfo{
|
ni := NotificationInfo{
|
||||||
epoch: 10,
|
epoch: 10,
|
||||||
topic: "test",
|
topic: "test",
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,8 +318,7 @@ type PutSingleRequest struct {
|
||||||
session.RequestHeaders
|
session.RequestHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
type PutSingleResponseBody struct {
|
type PutSingleResponseBody struct{}
|
||||||
}
|
|
||||||
|
|
||||||
type PutSingleResponse struct {
|
type PutSingleResponse struct {
|
||||||
body *PutSingleResponseBody
|
body *PutSingleResponseBody
|
||||||
|
|
|
@ -632,7 +632,8 @@ func (r *ResponseMetaHeader) SetStatus(v *status.Status) {
|
||||||
func SetStatus(msg interface {
|
func SetStatus(msg interface {
|
||||||
GetMetaHeader() *ResponseMetaHeader
|
GetMetaHeader() *ResponseMetaHeader
|
||||||
SetMetaHeader(*ResponseMetaHeader)
|
SetMetaHeader(*ResponseMetaHeader)
|
||||||
}, st *status.Status) {
|
}, st *status.Status,
|
||||||
|
) {
|
||||||
meta := msg.GetMetaHeader()
|
meta := msg.GetMetaHeader()
|
||||||
if meta == nil {
|
if meta == nil {
|
||||||
meta = new(ResponseMetaHeader)
|
meta = new(ResponseMetaHeader)
|
||||||
|
|
|
@ -43,7 +43,8 @@ func (c *RequestHeaders) SetVerificationHeader(v *RequestVerificationHeader) {
|
||||||
func (c *RequestHeaders) ToMessage(m interface {
|
func (c *RequestHeaders) ToMessage(m interface {
|
||||||
SetMetaHeader(*session.RequestMetaHeader)
|
SetMetaHeader(*session.RequestMetaHeader)
|
||||||
SetVerifyHeader(*session.RequestVerificationHeader)
|
SetVerifyHeader(*session.RequestVerificationHeader)
|
||||||
}) {
|
},
|
||||||
|
) {
|
||||||
m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.RequestMetaHeader))
|
m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.RequestMetaHeader))
|
||||||
m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.RequestVerificationHeader))
|
m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.RequestVerificationHeader))
|
||||||
}
|
}
|
||||||
|
@ -51,7 +52,8 @@ func (c *RequestHeaders) ToMessage(m interface {
|
||||||
func (c *RequestHeaders) FromMessage(m interface {
|
func (c *RequestHeaders) FromMessage(m interface {
|
||||||
GetMetaHeader() *session.RequestMetaHeader
|
GetMetaHeader() *session.RequestMetaHeader
|
||||||
GetVerifyHeader() *session.RequestVerificationHeader
|
GetVerifyHeader() *session.RequestVerificationHeader
|
||||||
}) error {
|
},
|
||||||
|
) error {
|
||||||
metaHdr := m.GetMetaHeader()
|
metaHdr := m.GetMetaHeader()
|
||||||
if metaHdr == nil {
|
if metaHdr == nil {
|
||||||
c.metaHeader = nil
|
c.metaHeader = nil
|
||||||
|
@ -122,7 +124,8 @@ func (c *ResponseHeaders) SetVerificationHeader(v *ResponseVerificationHeader) {
|
||||||
func (c *ResponseHeaders) ToMessage(m interface {
|
func (c *ResponseHeaders) ToMessage(m interface {
|
||||||
SetMetaHeader(*session.ResponseMetaHeader)
|
SetMetaHeader(*session.ResponseMetaHeader)
|
||||||
SetVerifyHeader(*session.ResponseVerificationHeader)
|
SetVerifyHeader(*session.ResponseVerificationHeader)
|
||||||
}) {
|
},
|
||||||
|
) {
|
||||||
m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.ResponseMetaHeader))
|
m.SetMetaHeader(c.metaHeader.ToGRPCMessage().(*session.ResponseMetaHeader))
|
||||||
m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.ResponseVerificationHeader))
|
m.SetVerifyHeader(c.verifyHeader.ToGRPCMessage().(*session.ResponseVerificationHeader))
|
||||||
}
|
}
|
||||||
|
@ -130,7 +133,8 @@ func (c *ResponseHeaders) ToMessage(m interface {
|
||||||
func (c *ResponseHeaders) FromMessage(m interface {
|
func (c *ResponseHeaders) FromMessage(m interface {
|
||||||
GetMetaHeader() *session.ResponseMetaHeader
|
GetMetaHeader() *session.ResponseMetaHeader
|
||||||
GetVerifyHeader() *session.ResponseVerificationHeader
|
GetVerifyHeader() *session.ResponseVerificationHeader
|
||||||
}) error {
|
},
|
||||||
|
) error {
|
||||||
metaHdr := m.GetMetaHeader()
|
metaHdr := m.GetMetaHeader()
|
||||||
if metaHdr == nil {
|
if metaHdr == nil {
|
||||||
c.metaHeader = nil
|
c.metaHeader = nil
|
||||||
|
|
|
@ -50,9 +50,7 @@ func (s *stablePrimitives) stableMarshal(buf []byte, wrongField bool) ([]byte, e
|
||||||
buf = make([]byte, s.stableSize())
|
buf = make([]byte, s.stableSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var i, offset, fieldNum int
|
||||||
i, offset, fieldNum int
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldNum = 1
|
fieldNum = 1
|
||||||
if wrongField {
|
if wrongField {
|
||||||
|
|
|
@ -205,22 +205,22 @@ type marshalerDesc struct {
|
||||||
var marshalers = map[protoreflect.Kind]marshalerDesc{
|
var marshalers = map[protoreflect.Kind]marshalerDesc{
|
||||||
protoreflect.BoolKind: {Prefix: "Bool"},
|
protoreflect.BoolKind: {Prefix: "Bool"},
|
||||||
protoreflect.EnumKind: {Prefix: "Enum"},
|
protoreflect.EnumKind: {Prefix: "Enum"},
|
||||||
//protoreflect.Int32Kind: "",
|
// protoreflect.Int32Kind: "",
|
||||||
//protoreflect.Sint32Kind: "",
|
// protoreflect.Sint32Kind: "",
|
||||||
protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true},
|
protoreflect.Uint32Kind: {Prefix: "UInt32", RepeatedDouble: true},
|
||||||
protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true},
|
protoreflect.Int64Kind: {Prefix: "Int64", RepeatedDouble: true},
|
||||||
//protoreflect.Sint64Kind: "",
|
// protoreflect.Sint64Kind: "",
|
||||||
protoreflect.Uint64Kind: {Prefix: "UInt64", RepeatedDouble: true},
|
protoreflect.Uint64Kind: {Prefix: "UInt64", RepeatedDouble: true},
|
||||||
//protoreflect.Sfixed32Kind: "",
|
// protoreflect.Sfixed32Kind: "",
|
||||||
protoreflect.Fixed32Kind: {Prefix: "Fixed32", RepeatedDouble: true},
|
protoreflect.Fixed32Kind: {Prefix: "Fixed32", RepeatedDouble: true},
|
||||||
//protoreflect.FloatKind: "",
|
// protoreflect.FloatKind: "",
|
||||||
//protoreflect.Sfixed64Kind: "",
|
// protoreflect.Sfixed64Kind: "",
|
||||||
protoreflect.Fixed64Kind: {Prefix: "Fixed64", RepeatedDouble: true},
|
protoreflect.Fixed64Kind: {Prefix: "Fixed64", RepeatedDouble: true},
|
||||||
protoreflect.DoubleKind: {Prefix: "Float64"},
|
protoreflect.DoubleKind: {Prefix: "Float64"},
|
||||||
protoreflect.StringKind: {Prefix: "String"},
|
protoreflect.StringKind: {Prefix: "String"},
|
||||||
protoreflect.BytesKind: {Prefix: "Bytes"},
|
protoreflect.BytesKind: {Prefix: "Bytes"},
|
||||||
protoreflect.MessageKind: {Prefix: "NestedStructure"},
|
protoreflect.MessageKind: {Prefix: "NestedStructure"},
|
||||||
//protoreflect.GroupKind: "",
|
// protoreflect.GroupKind: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
func sortFields(fs []*protogen.Field) []*protogen.Field {
|
func sortFields(fs []*protogen.Field) []*protogen.Field {
|
||||||
|
|
|
@ -109,5 +109,4 @@ func TestVerifyNeonWallet(t *testing.T) {
|
||||||
}
|
}
|
||||||
require.True(t, VerifyMessage(nil, sm))
|
require.True(t, VerifyMessage(nil, sm))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue