_linters/src/honnef.co/go/tools/unused/unused.go
func (c *Checker) processCompositeLiteral(pkg *lint.Pkg, node ast.Node) {
	// XXX how does this actually work? wouldn't it match t{}?
	if node, ok := node.(*ast.CompositeLit); ok {
		typ := pkg.TypesInfo.TypeOf(node)
		if _, ok := typ.(*types.Named); ok {
			typ = typ.Underlying()
		}
		if _, ok := typ.(*types.Struct); !ok {
			return
		}

		if isBasicStruct(node.Elts) {
			c.markFields(typ)
		}
	}
}
func (c *Checker) processCompositeLiteral(pkg *lint.Pkg, node ast.Node) {
	// XXX how does this actually work? wouldn't it match t{}?
	if node, ok := node.(*ast.CompositeLit); ok {
		typ := pkg.TypesInfo.TypeOf(node)
		if _, ok := typ.(*types.Named); ok {
			typ = typ.Underlying()
		}
		if _, ok := typ.(*types.Struct); !ok {
			return
		}

		if isBasicStruct(node.Elts) {
			c.markFields(typ)
		}
	}
}
func ( c * Checker ) processCompositeLiteral ( pkg * lint . Pkg , node ast . Node ) { // XXX how does this actually work? wouldn't it match t{}? if node , ok := node . ( * ast . CompositeLit ) ; ok { typ := pkg . TypesInfo . TypeOf ( node ) if _ , ok := typ . ( * types . Named ) ; ok { typ = typ . Underlying ( ) } if _ , ok := typ . ( * types . Struct ) ; ! ok { return } if isBasicStruct ( node . Elts ) { c . markFields ( typ ) } } }
// processCompositeLiteral marks fields as used if the struct is used
// in a composite literal.
processCompositeLiteral marks fields as used if the struct is used in a composite literal .