Source file test/fixedbugs/issue54220.go
1 // run 2 3 // Copyright 2022 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package main 8 9 import ( 10 "strconv" 11 "sync/atomic" 12 "unsafe" 13 ) 14 15 type t struct { 16 i1 atomic.Int32 17 i2 atomic.Int64 18 } 19 20 var v t 21 22 func main() { 23 if o := unsafe.Offsetof(v.i2); o != 8 { 24 panic("unexpected offset, want: 8, got: " + strconv.Itoa(int(o))) 25 } 26 } 27