@ -72,12 +72,12 @@ func NamedTypes(pkg *packages.Package) map[string]*types.Named {
}
}
// AssertStructUnchanged generates code that asserts at compile time that type t is unchanged.
// AssertStructUnchanged generates code that asserts at compile time that type t is unchanged.
// thisPkg is the package containing t.
// tname is the named type corresponding to t.
// tname is the named type corresponding to t.
// ctx is a single-word context for this assertion, such as "Clone".
// ctx is a single-word context for this assertion, such as "Clone".
// thisPkg is the package containing t.
// If non-nil, AssertStructUnchanged will add elements to imports
// If non-nil, AssertStructUnchanged will add elements to imports
// for each package path that the caller must import for the returned code to compile.
// for each package path that the caller must import for the returned code to compile.
func AssertStructUnchanged ( t * types . Struct , t name, ctx string , t hisPkg * types . Package , imports map [ string ] struct { } ) [ ] byte {
func AssertStructUnchanged ( t * types . Struct , t hisPkg * types . Package , tname , ctx string , imports map [ string ] struct { } ) [ ] byte {
buf := new ( bytes . Buffer )
buf := new ( bytes . Buffer )
w := func ( format string , args ... interface { } ) {
w := func ( format string , args ... interface { } ) {
fmt . Fprintf ( buf , format + "\n" , args ... )
fmt . Fprintf ( buf , format + "\n" , args ... )