Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use go1.18 to build gitea #19099

Merged
merged 14 commits into from Mar 16, 2022
Merged

use go1.18 to build gitea #19099

merged 14 commits into from Mar 16, 2022

Conversation

techknowlogick
Copy link
Member

@techknowlogick techknowlogick commented Mar 15, 2022

& update min go version to 1.17

includes parts of #18874 (but doesn't replace that PR)

Depends on: docker-library/golang#411 & docker-library/official-images#12045

@techknowlogick techknowlogick added this to the 1.17.0 milestone Mar 15, 2022
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 15, 2022
@techknowlogick techknowlogick added pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! dependencies labels Mar 15, 2022
@hhoffstaette
Copy link

I just rebuilt my gitea package with 1.18.0 (Linux, amd64) and get a reproducible crash on startup:

unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x47029f]

goroutine 1 [running]:
runtime.throw({0x27ca1ca?, 0xd0?})
	/usr/lib/go/src/runtime/panic.go:992 +0x71 fp=0xc00430ec10 sp=0xc00430ebe0 pc=0x43fcd1
runtime.sigpanic()
	/usr/lib/go/src/runtime/signal_unix.go:825 +0x305 fp=0xc00430ec60 sp=0xc00430ec10 pc=0x4560a5
aeshashbody()
	/usr/lib/go/src/runtime/asm_amd64.s:1343 +0x39f fp=0xc00430ec68 sp=0xc00430ec60 pc=0x47029f
runtime.mapiternext(0xc00226b940)
	/usr/lib/go/src/runtime/map.go:934 +0x2cb fp=0xc00430ecd8 sp=0xc00430ec68 pc=0x41980b
runtime.mapiterinit(0xc00430ed70?, 0x417025?, 0xc00242ca08?)
	/usr/lib/go/src/runtime/map.go:861 +0x228 fp=0xc00430ecf8 sp=0xc00430ecd8 pc=0x4194e8
reflect.mapiterinit(0x418dfd?, 0x23fe160?, 0xc0046aa838?)
	/usr/lib/go/src/runtime/map.go:1373 +0x19 fp=0xc00430ed20 sp=0xc00430ecf8 pc=0x46ca19
github.com/modern-go/reflect2.(*UnsafeMapType).UnsafeIterate(...)
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/modern-go/reflect2/unsafe_map.go:112
github.com/json-iterator/go.(*sortKeysMapEncoder).Encode(0xc0046b2450, 0xc000f82418, 0xc0000916e0)
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/json-iterator/go/reflect_map.go:291 +0x225 fp=0xc00430ee90 sp=0xc00430ed20 pc=0x5ffe85
github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc00129d380, 0xc0046b2270, 0xc00226b940?)
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/json-iterator/go/reflect.go:219 +0x82 fp=0xc00430eec8 sp=0xc00430ee90 pc=0x5f8182
github.com/json-iterator/go.(*Stream).WriteVal(0xc0000916e0, {0x243f440, 0xc0046b2270})
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/json-iterator/go/reflect.go:98 +0x158 fp=0xc00430ef38 sp=0xc00430eec8 pc=0x5f7498
github.com/json-iterator/go.(*frozenConfig).Marshal(0xc0000be280, {0x243f440, 0xc0046b2270})
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/json-iterator/go/config.go:299 +0xc9 fp=0xc00430efd0 sp=0xc00430ef38 pc=0x5ee5c9
code.gitea.io/gitea/modules/json.JSONiter.Marshal({{0x3aeb3d8?, 0xc0000be280?}}, {0x243f440?, 0xc0046b2270?})
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/json/json.go:78 +0x37 fp=0xc00430eff8 sp=0xc00430efd0 pc=0x618f97
code.gitea.io/gitea/modules/json.(*JSONiter).Marshal(0x243f440?, {0x243f440?, 0xc0046b2270?})
	<autogenerated>:1 +0x45 fp=0xc00430f028 sp=0xc00430eff8 pc=0x619e85
code.gitea.io/gitea/modules/json.Marshal(...)
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/json/json.go:103
code.gitea.io/gitea/modules/setting.generateLogConfig(0x41cc99?, {0xc00242d921, 0x4}, {{0x27bfc5b, 0x4}, {0x280d419, 0x8}, {0xc004630c48, 0x18}, 0x2710, ...})
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/setting/log.go:205 +0x1469 fp=0xc00430f198 sp=0xc00430f028 pc=0x89d569
code.gitea.io/gitea/modules/setting.newLogService()
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/setting/log.go:323 +0x6b5 fp=0xc00430f388 sp=0xc00430f198 pc=0x89ebf5
code.gitea.io/gitea/modules/setting.NewLogServices(0x0?)
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/setting/log.go:349 +0x1d fp=0xc00430f3a8 sp=0xc00430f388 pc=0x89f03d
code.gitea.io/gitea/modules/setting.NewServices()
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/setting/setting.go:1224 +0x31 fp=0xc00430f3c0 sp=0xc00430f3a8 pc=0x8ae9b1
code.gitea.io/gitea/routers.InitGitServices()
	/tmp/portage/www-apps/gitea-1.16.4/work/routers/init.go:74 +0x19 fp=0xc00430f3d8 sp=0xc00430f3c0 pc=0x20014b9
code.gitea.io/gitea/routers.GlobalInitInstalled({0x3adc7a8, 0xc00226af40})
	/tmp/portage/www-apps/gitea-1.16.4/work/routers/init.go:119 +0x385 fp=0xc00430f4c0 sp=0xc00430f3d8 pc=0x2001ae5
code.gitea.io/gitea/cmd.runWeb(0xc00255e420)
	/tmp/portage/www-apps/gitea-1.16.4/work/cmd/web.go:153 +0x811 fp=0xc00430f5a0 sp=0xc00430f4c0 pc=0x20dc7f1
github.com/urfave/cli.HandleAction({0x23a8120?, 0x35b8bf0?}, 0x3?)
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/urfave/cli/app.go:524 +0xa8 fp=0xc00430f5b8 sp=0xc00430f5a0 pc=0x1aaaba8
github.com/urfave/cli.Command.Run({{0x27b4a45, 0x3}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x2921148, 0x16}, {0x0, ...}, ...}, ...)
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/urfave/cli/command.go:173 +0x652 fp=0xc00430f798 sp=0xc00430f5b8 pc=0x1aab992
github.com/urfave/cli.(*App).Run(0xc0002516c0, {0xc00003c080, 0x4, 0x4})
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/urfave/cli/app.go:277 +0x8a7 fp=0xc00430fd70 sp=0xc00430f798 pc=0x1aa8207
main.main()
	/tmp/portage/www-apps/gitea-1.16.4/work/main.go:115 +0xcf9 fp=0xc00430ff80 sp=0xc00430fd70 pc=0x2112999
runtime.main()
	/usr/lib/go/src/runtime/proc.go:250 +0x212 fp=0xc00430ffe0 sp=0xc00430ff80 pc=0x4423f2
runtime.goexit()
	/usr/lib/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00430ffe8 sp=0xc00430ffe0 pc=0x472ea1

goroutine 7 [select]:
code.gitea.io/gitea/modules/log.(*MultiChannelledLog).Start(0xc000186100)
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/log/event.go:300 +0x26c
created by code.gitea.io/gitea/modules/log.(*MultiChannelledLog).AddLogger
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/log/event.go:190 +0x176

goroutine 34 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc000254000?, 0xc000254060?})
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0x8f
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0x92

goroutine 35 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc000254000?, 0xc000254060?})
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0x8f
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0x92

goroutine 36 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc000254000?, 0xc000254060?})
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0x8f
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0x92

goroutine 37 [select]:
github.com/blevesearch/bleve_index_api.AnalysisWorker({0xc000254000?, 0xc000254060?})
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:46 +0x8f
created by github.com/blevesearch/bleve_index_api.NewAnalysisQueue
	/tmp/portage/www-apps/gitea-1.16.4/work/vendor/github.com/blevesearch/bleve_index_api/analysis.go:38 +0x92

goroutine 19 [select]:
code.gitea.io/gitea/modules/graceful.(*Manager).handleSignals(0x0?, {0x3adc7a8, 0xc00226ae80})
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/graceful/manager_unix.go:118 +0x1c6
created by code.gitea.io/gitea/modules/graceful.(*Manager).start
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/graceful/manager_unix.go:65 +0x19a

goroutine 20 [semacquire]:
sync.runtime_Semacquire(0x0?)
	/usr/lib/go/src/runtime/sema.go:56 +0x25
sync.(*WaitGroup).Wait(0x0?)
	/usr/lib/go/src/sync/waitgroup.go:136 +0x52
code.gitea.io/gitea/modules/graceful.(*Manager).start.func1()
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/graceful/manager_unix.go:73 +0x65
created by code.gitea.io/gitea/modules/graceful.(*Manager).start
	/tmp/portage/www-apps/gitea-1.16.4/work/modules/graceful/manager_unix.go:69 +0x205

goroutine 50 [syscall]:
os/signal.signal_recv()
	/usr/lib/go/src/runtime/sigqueue.go:151 +0x2f
os/signal.loop()
	/usr/lib/go/src/os/signal/signal_unix.go:23 +0x19
created by os/signal.Notify.func1.1
	/usr/lib/go/src/os/signal/signal.go:151 +0x2a

This worked fine when built with 1.17.8 earlier today.

@Gusted
Copy link
Contributor

Gusted commented Mar 15, 2022

Need to backport #18644

@Gusted
Copy link
Contributor

Gusted commented Mar 15, 2022

#19100

@silverwind
Copy link
Member

Missed a few places for updating minimum go version, like in README.

}

for n, c := range cases {
i, _ := net.ParseIP(c.ip)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we already should include go1.18 code, even for tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is go1.17 code: https://cs.opensource.google/go/go/+/refs/tags/go1.17:src/net/ip.go;l=704

Edit: This just adds tests for logic we already had

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 16, 2022
@techknowlogick
Copy link
Member Author

techknowlogick commented Mar 16, 2022

golangci-lint doesn't support go1.18 yet: golangci/golangci-lint#2374 & go-critic/go-critic#1126

@techknowlogick techknowlogick merged commit ed1d95c into go-gitea:main Mar 16, 2022
@techknowlogick techknowlogick deleted the go18 branch March 16, 2022 04:08
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 16, 2022
* giteaoffical/main:
  rm .sample hooks which aren't used (go-gitea#19101)
  use go1.18 to build gitea (go-gitea#19099)
  Use `go run` for tool dependencies, require go 1.17 (go-gitea#18874)
  Update golang.org/x/crypto (go-gitea#19097)
  Handle email address not exist. (go-gitea#19089)
techknowlogick added a commit to techknowlogick/gitea that referenced this pull request Mar 18, 2022
* use go1.18 to build gitea& update min go version to 1.17

* bump in a few more places

* add a few simple tests for isipprivate

* update go.mod

* update URL to https://go.dev/dl/

* golangci-lint

* attempt golangci-lint workaround

* change version

* bump fumpt version

* skip strings.title test

* go mod tidy

* update tests as some aren't private??

* update tests
6543 added a commit that referenced this pull request Mar 19, 2022
Backport #19120 
Backport #19099 
Backport #18874 
Backport #18420
Backport #19128
Backport #18270 

Bump to build with go1.18

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Jelle Hulter <jellehulter@gmail.com>
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
* use go1.18 to build gitea& update min go version to 1.17

* bump in a few more places

* add a few simple tests for isipprivate

* update go.mod

* update URL to https://go.dev/dl/

* golangci-lint

* attempt golangci-lint workaround

* change version

* bump fumpt version

* skip strings.title test

* go mod tidy

* update tests as some aren't private??

* update tests
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
@6543 6543 added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Jun 18, 2022
@6543
Copy link
Member

6543 commented Jun 18, 2022

-> #19918

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants