From 10ec95751e646a2f677616cd62dab305c493058f Mon Sep 17 00:00:00 2001 From: Trim21 Date: Thu, 10 Oct 2024 18:27:21 +0800 Subject: [PATCH] build: upgrade golang to 1.23.1 --- go.mod | 5 +++-- go.sum | 8 ++++---- internal/collections/infra/mysql_repo_compat.go | 6 ++++-- internal/subject/mysq_repository_compat.go | 8 +++++--- internal/user/model.go | 8 +++++--- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index d976e61f7..c12045895 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bangumi/server -go 1.22.6 +go 1.23.1 require ( github.com/avast/retry-go/v4 v4.6.0 @@ -27,7 +27,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 github.com/trim21/errgo v0.0.3 - github.com/trim21/go-phpserialize v0.0.22 + github.com/trim21/go-phpserialize v0.1.0-alpha.3 github.com/trim21/go-redis-prometheus v0.0.0 github.com/trim21/htest v0.0.4 github.com/trim21/pkg v0.0.3 @@ -79,6 +79,7 @@ require ( github.com/valyala/fasttemplate v1.2.2 // indirect go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect + go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect diff --git a/go.sum b/go.sum index 9f5584fa4..018e8d75f 100644 --- a/go.sum +++ b/go.sum @@ -415,8 +415,8 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/trim21/errgo v0.0.3 h1:q0cUPTs+4c5NxByA4f0HUGRvlNyBlUtdxFiTKQdTE68= github.com/trim21/errgo v0.0.3/go.mod h1:AH1KzogdvSkSPXbZq9QAuqSt1L1Eu5W8eYK32zPYv9s= -github.com/trim21/go-phpserialize v0.0.22 h1:gcs36ir5s3iPFtGrp+3uU/R1lO05Et0nuhaBdUahq0Y= -github.com/trim21/go-phpserialize v0.0.22/go.mod h1:BxWksx+mEAaKC+ekgfTHas1z25dEE3n0bZbAp+tsJUM= +github.com/trim21/go-phpserialize v0.1.0-alpha.3 h1:6Z09BQa5Sr3ODyWxOHVHeiGezkIxam2asocjJ2xkfQo= +github.com/trim21/go-phpserialize v0.1.0-alpha.3/go.mod h1:/3zMYuOzpcKOevwP3ZN0WxdVRaB3CzJh5T2i41QPgRQ= github.com/trim21/go-redis-prometheus v0.0.0 h1:9svVIZkKaDGE1bSRbtTQdsKBzW+QEWfwc35QIF8JsfA= github.com/trim21/go-redis-prometheus v0.0.0/go.mod h1:UTXPI/fofnsXF9/X/WtvwhAdbSOBVjLg17xDjQj9VgU= github.com/trim21/htest v0.0.4 h1:dDIzKNdIClgtB158DlO+Xf0sfwNycmx3kfo/FJuY+eE= @@ -429,8 +429,6 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/volatiletech/null/v9 v9.0.0 h1:JCdlHEiSRVxOi7/MABiEfdsqmuj9oTV20Ao7VvZ0JkE= -github.com/volatiletech/null/v9 v9.0.0/go.mod h1:zRFghPVahaiIMRXiUJrc6gsoG83Cm3ZoAfSTw7VHGQc= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= @@ -461,6 +459,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 h1:lGdhQUN/cnWdSH3291CUuxSEqc+AsGTiDxPP3r2J0l4= +go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/internal/collections/infra/mysql_repo_compat.go b/internal/collections/infra/mysql_repo_compat.go index bd95aba89..c4c5435d1 100644 --- a/internal/collections/infra/mysql_repo_compat.go +++ b/internal/collections/infra/mysql_repo_compat.go @@ -33,8 +33,10 @@ type mysqlEpCollection map[model.EpisodeID]mysqlEpCollectionItem func deserializePhpEpStatus(phpSerialized []byte) (mysqlEpCollection, error) { var e map[model.EpisodeID]mysqlEpCollectionItem - if err := phpserialize.Unmarshal(phpSerialized, &e); err != nil { - return nil, errgo.Wrap(err, "php deserialize") + if len(phpSerialized) != 0 { + if err := phpserialize.Unmarshal(phpSerialized, &e); err != nil { + return nil, errgo.Wrap(err, "php deserialize") + } } return e, nil diff --git a/internal/subject/mysq_repository_compat.go b/internal/subject/mysq_repository_compat.go index 4f5c203e8..a1d761142 100644 --- a/internal/subject/mysq_repository_compat.go +++ b/internal/subject/mysq_repository_compat.go @@ -30,9 +30,11 @@ type Tag struct { func ParseTags(b []byte) ([]model.Tag, error) { var tags []Tag - err := phpserialize.Unmarshal(b, &tags) - if err != nil { - return nil, errgo.Wrap(err, "ParseTags: phpserialize.Unmarshal") + if len(b) != 0 { + err := phpserialize.Unmarshal(b, &tags) + if err != nil { + return nil, errgo.Wrap(err, "ParseTags: phpserialize.Unmarshal") + } } return slice.MapFilter(tags, func(item Tag) (model.Tag, bool) { diff --git a/internal/user/model.go b/internal/user/model.go index d550b7df2..2ee5e2bbb 100644 --- a/internal/user/model.go +++ b/internal/user/model.go @@ -77,9 +77,11 @@ type PrivacySettings struct { func (settings *PrivacySettings) Unmarshal(s []byte) { rawMap := make(map[PrivacySettingsField]ReceiveFilter, 4) - err := phpserialize.Unmarshal(s, &rawMap) - if err != nil { - return + if len(s) != 0 { + err := phpserialize.Unmarshal(s, &rawMap) + if err != nil { + return + } } settings.ReceivePrivateMessage = rawMap[PrivacyReceivePrivateMessage]