MM-40852: Fix make gen-serialized breakage (#19291)
- Fixed the Makefile command so that it can be run in CI - Changed to go install to make it compatible with >1.16 versions. - Removed unnecessary lines in go.tools.mod now that we aren't using that. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2f58c88f1b
Коммит
93a9c6c293
18
Makefile
18
Makefile
@@ -17,6 +17,12 @@ else
|
||||
export IS_LINUX =
|
||||
endif
|
||||
|
||||
define LICENSE_HEADER
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
endef
|
||||
|
||||
IS_CI ?= false
|
||||
# Build Flags
|
||||
BUILD_NUMBER ?= $(BUILD_NUMBER:)
|
||||
@@ -635,6 +641,7 @@ ifneq ($(MM_NO_ENTERPRISE_LINT),true)
|
||||
endif
|
||||
endif
|
||||
|
||||
gen-serialized: export LICENSE_HEADER:=$(LICENSE_HEADER)
|
||||
gen-serialized: ## Generates serialization methods for hot structs
|
||||
# This tool only works at a file level, not at a package level.
|
||||
# There will be some warnings about "unresolved identifiers",
|
||||
@@ -643,10 +650,19 @@ gen-serialized: ## Generates serialization methods for hot structs
|
||||
# identifiers will be resolved. An alternative to remove the warnings
|
||||
# would be to temporarily move all the structs to the same file,
|
||||
# but that involves a lot of manual work.
|
||||
$(GO) get -modfile=go.tools.mod github.com/tinylib/msgp
|
||||
$(GO) install github.com/tinylib/msgp@v1.1.6
|
||||
$(GOBIN)/msgp -file=./model/session.go -tests=false -o=./model/session_serial_gen.go
|
||||
@echo "$$LICENSE_HEADER" > tmp.go
|
||||
@cat ./model/session_serial_gen.go >> tmp.go
|
||||
@mv tmp.go ./model/session_serial_gen.go
|
||||
$(GOBIN)/msgp -file=./model/user.go -tests=false -o=./model/user_serial_gen.go
|
||||
@echo "$$LICENSE_HEADER" > tmp.go
|
||||
@cat ./model/user_serial_gen.go >> tmp.go
|
||||
@mv tmp.go ./model/user_serial_gen.go
|
||||
$(GOBIN)/msgp -file=./model/team_member.go -tests=false -o=./model/team_member_serial_gen.go
|
||||
@echo "$$LICENSE_HEADER" > tmp.go
|
||||
@cat ./model/team_member_serial_gen.go >> tmp.go
|
||||
@mv tmp.go ./model/team_member_serial_gen.go
|
||||
|
||||
todo: ## Display TODO and FIXME items in the source code.
|
||||
@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime TODO
|
||||
|
||||
@@ -8,10 +8,8 @@ require (
|
||||
github.com/jstemmer/go-junit-report v0.9.1 // indirect
|
||||
github.com/jteeuwen/go-bindata v3.0.7+incompatible // indirect
|
||||
github.com/mattermost/mattermost-utilities/mmgotool v0.0.0-20210721133912-8b250bf4d0f6 // indirect
|
||||
github.com/philhofer/fwd v1.0.0 // indirect
|
||||
github.com/reflog/struct2interface v0.6.1 // indirect
|
||||
github.com/spf13/cobra v1.1.3 // indirect
|
||||
github.com/tinylib/msgp v1.1.2 // indirect
|
||||
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31 // indirect
|
||||
github.com/vektra/mockery v1.1.2 // indirect
|
||||
)
|
||||
|
||||
@@ -389,10 +389,6 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
|
||||
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
github.com/philhofer/fwd v1.1.1 h1:GdGcTjf5RNAxwS4QLsiMzJYj5KEvPJD3Abr261yRQXQ=
|
||||
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=
|
||||
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||
@@ -473,10 +469,6 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tinylib/msgp v1.1.2 h1:gWmO7n0Ys2RBEb7GPYB9Ujq8Mk5p2U08lRnmMcGy6BQ=
|
||||
github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tinylib/msgp v1.1.5 h1:2gXmtWueD2HefZHQe1QOy9HVzmFrLOVvsXwXBQ0ayy0=
|
||||
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31 h1:OXcKh35JaYsGMRzpvFkLv/MEyPuL49CThT1pZ8aSml4=
|
||||
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
|
||||
|
||||
@@ -69,6 +69,7 @@ type TeamMembersGetOptions struct {
|
||||
ViewRestrictions *ViewUsersRestrictions
|
||||
}
|
||||
|
||||
//msgp:ignore TeamInviteReminderData
|
||||
type TeamInviteReminderData struct {
|
||||
Interval string
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ func (z *User) DecodeMsg(dc *msgp.Reader) (err error) {
|
||||
err = msgp.WrapError(err)
|
||||
return
|
||||
}
|
||||
if zb0001 != 32 {
|
||||
err = msgp.ArrayError{Wanted: 32, Got: zb0001}
|
||||
if zb0001 != 33 {
|
||||
err = msgp.ArrayError{Wanted: 33, Got: zb0001}
|
||||
return
|
||||
}
|
||||
z.Id, err = dc.ReadString()
|
||||
@@ -205,13 +205,18 @@ func (z *User) DecodeMsg(dc *msgp.Reader) (err error) {
|
||||
err = msgp.WrapError(err, "TermsOfServiceCreateAt")
|
||||
return
|
||||
}
|
||||
z.DisableWelcomeEmail, err = dc.ReadBool()
|
||||
if err != nil {
|
||||
err = msgp.WrapError(err, "DisableWelcomeEmail")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// EncodeMsg implements msgp.Encodable
|
||||
func (z *User) EncodeMsg(en *msgp.Writer) (err error) {
|
||||
// array header, size 32
|
||||
err = en.Append(0xdc, 0x0, 0x20)
|
||||
// array header, size 33
|
||||
err = en.Append(0xdc, 0x0, 0x21)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -389,14 +394,19 @@ func (z *User) EncodeMsg(en *msgp.Writer) (err error) {
|
||||
err = msgp.WrapError(err, "TermsOfServiceCreateAt")
|
||||
return
|
||||
}
|
||||
err = en.WriteBool(z.DisableWelcomeEmail)
|
||||
if err != nil {
|
||||
err = msgp.WrapError(err, "DisableWelcomeEmail")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// MarshalMsg implements msgp.Marshaler
|
||||
func (z *User) MarshalMsg(b []byte) (o []byte, err error) {
|
||||
o = msgp.Require(b, z.Msgsize())
|
||||
// array header, size 32
|
||||
o = append(o, 0xdc, 0x0, 0x20)
|
||||
// array header, size 33
|
||||
o = append(o, 0xdc, 0x0, 0x21)
|
||||
o = msgp.AppendString(o, z.Id)
|
||||
o = msgp.AppendInt64(o, z.CreateAt)
|
||||
o = msgp.AppendInt64(o, z.UpdateAt)
|
||||
@@ -449,6 +459,7 @@ func (z *User) MarshalMsg(b []byte) (o []byte, err error) {
|
||||
o = msgp.AppendInt64(o, z.BotLastIconUpdate)
|
||||
o = msgp.AppendString(o, z.TermsOfServiceId)
|
||||
o = msgp.AppendInt64(o, z.TermsOfServiceCreateAt)
|
||||
o = msgp.AppendBool(o, z.DisableWelcomeEmail)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -460,8 +471,8 @@ func (z *User) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
||||
err = msgp.WrapError(err)
|
||||
return
|
||||
}
|
||||
if zb0001 != 32 {
|
||||
err = msgp.ArrayError{Wanted: 32, Got: zb0001}
|
||||
if zb0001 != 33 {
|
||||
err = msgp.ArrayError{Wanted: 33, Got: zb0001}
|
||||
return
|
||||
}
|
||||
z.Id, bts, err = msgp.ReadStringBytes(bts)
|
||||
@@ -646,6 +657,11 @@ func (z *User) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
||||
err = msgp.WrapError(err, "TermsOfServiceCreateAt")
|
||||
return
|
||||
}
|
||||
z.DisableWelcomeEmail, bts, err = msgp.ReadBoolBytes(bts)
|
||||
if err != nil {
|
||||
err = msgp.WrapError(err, "DisableWelcomeEmail")
|
||||
return
|
||||
}
|
||||
o = bts
|
||||
return
|
||||
}
|
||||
@@ -664,7 +680,7 @@ func (z *User) Msgsize() (s int) {
|
||||
} else {
|
||||
s += msgp.StringPrefixSize + len(*z.RemoteId)
|
||||
}
|
||||
s += msgp.Int64Size + msgp.BoolSize + msgp.StringPrefixSize + len(z.BotDescription) + msgp.Int64Size + msgp.StringPrefixSize + len(z.TermsOfServiceId) + msgp.Int64Size
|
||||
s += msgp.Int64Size + msgp.BoolSize + msgp.StringPrefixSize + len(z.BotDescription) + msgp.Int64Size + msgp.StringPrefixSize + len(z.TermsOfServiceId) + msgp.Int64Size + msgp.BoolSize
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user