-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed as duplicate of#60725
Closed as duplicate of#60725
Copy link
Labels
compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Description
Go version
go version go1.24.0 linux/amd64
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/marco/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/marco/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3394646905=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/marco/Dev/authd/go.mod'
GOMODCACHE='/tmp/go-path/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/tmp/go-path'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/snap/go/10853'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/marco/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/snap/go/10853/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
We had some code doing:
package main
/*
#include <stdlib.h>
typedef struct {
int value;
} Struct;
*/
import "C"
import "fmt"
type CStruct = C.Struct
func (s *CStruct) init(value int) {
s.value = C.int(value)
}
func main() {
s := &CStruct{}
s.init(1234)
fmt.Println(s.value)
}
What did you see happen?
./main.go:16:10: cannot define new methods on non-local type CStruct
What did you expect to see?
This used to work until go 1.23, now it's not allowed anymore.
Metadata
Metadata
Assignees
Labels
compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.