github.com/noisysockets/netstack@v0.6.0/pkg/sync/runtime_not_go121_unsafe.go (about)

     1  // Copyright 2023 The gVisor Authors.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  // runtime.maptype is moved to internal/abi.MapType in Go 1.21.
     7  //
     8  //go:build !go1.21
     9  
    10  package sync
    11  
    12  import (
    13  	"unsafe"
    14  )
    15  
    16  // Use checkoffset to assert that maptype.hasher (the only field we use) has
    17  // the correct offset.
    18  const maptypeHasherOffset = unsafe.Offsetof(maptype{}.Hasher) // +checkoffset runtime maptype.hasher