You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=0
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=on
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=
set GOCACHE=C:\Users\User\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\User\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\User\AppData\Local\Temp\go-build1004090984=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMOD=C:\Jetbrains\projects\train-booking-vertical-slice\go.mod
set GOMODCACHE=C:\Users\User\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\User\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:/Users/User/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.0.windows-amd64
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\User\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\User\go\pkg\mod\golang.org\toolchain@v0.0.1-go1.24.0.windows-amd64\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.0
set GOWORK=
set PKG_CONFIG=pkg-config
What did you do?
Was writing a nondescript train booking service implementation. I used init() in one of my packages. It prints text using fmt.Println.
Entire source code is in the attached archive.
What did you see happen?
Text from init() gets printed several times.
What did you expect to see?
Text from init() gets printed only once, as it should.
The text was updated successfully, but these errors were encountered:
Disabling Prefork in fiber.Config fixes this issue. I think this warrants some explanation and documentation.
selamba
changed the title
init() runs more than once
init() runs more than once when using Fiber's Prefork feature: language bug or undocumented quirk?
Apr 15, 2025
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
Go version
go version go1.24.0 windows/amd64
Output of
go env
in your module/workspace:What did you do?
Was writing a nondescript train booking service implementation. I used
init()
in one of my packages. It prints text usingfmt.Println
.Entire source code is in the attached archive.
What did you see happen?
Text from
init()
gets printed several times.What did you expect to see?
Text from
init()
gets printed only once, as it should.The text was updated successfully, but these errors were encountered: