3 ms·
> There can never be an automated fix for this since code can depend on the memory layout. I think that's very specifically discouraged in Go, unless there's a
by mariusor 5y ago
> There can never be an automated fix for this since code can depend on the memory layout.
I think that's very specifically discouraged in Go, unless there's a way to do it without using the "unsafe" package that I don't know of:
> Package unsafe contains operations that step around the type safety of Go programs.
> Packages that import unsafe may be non-portable and are not protected by the Go 1 compatibility guidelines.
- AtNightWeCode 5y agoI would not be surprised if somethings may break if there is a discrepancy between the structs and the memory layout. Stranger things have been seen. If people followed best practices, there would not be a problem in the first place. How to work with and check memory alignment is very much a known area. …and I do believe there is linter for this in Go as well.