_linters/src/honnef.co/go/tools/unused/unused.go
func (c *Checker) deduplicate() {
	m := map[token.Position]struct{ used, quiet bool }{}
	for _, node := range c.graph.nodes {
		obj, ok := node.obj.(types.Object)
		if !ok {
			continue
		}
		pos := c.prog.Fset().Position(obj.Pos())
		m[pos] = struct{ used, quiet bool }{
			m[pos].used || node.used,
			m[pos].quiet || node.quiet,
		}
	}

	for _, node := range c.graph.nodes {
		obj, ok := node.obj.(types.Object)
		if !ok {
			continue
		}
		pos := c.prog.Fset().Position(obj.Pos())
		node.used = m[pos].used
		node.quiet = m[pos].quiet
	}
}
func (c *Checker) deduplicate() {
	m := map[token.Position]struct{ used, quiet bool }{}
	for _, node := range c.graph.nodes {
		obj, ok := node.obj.(types.Object)
		if !ok {
			continue
		}
		pos := c.prog.Fset().Position(obj.Pos())
		m[pos] = struct{ used, quiet bool }{
			m[pos].used || node.used,
			m[pos].quiet || node.quiet,
		}
	}

	for _, node := range c.graph.nodes {
		obj, ok := node.obj.(types.Object)
		if !ok {
			continue
		}
		pos := c.prog.Fset().Position(obj.Pos())
		node.used = m[pos].used
		node.quiet = m[pos].quiet
	}
}
func ( c * Checker ) deduplicate ( ) { m := map [ token . Position ] struct { used , quiet bool } { } for _ , node := range c . graph . nodes { obj , ok := node . obj . ( types . Object ) if ! ok { continue } pos := c . prog . Fset ( ) . Position ( obj . Pos ( ) ) m [ pos ] = struct { used , quiet bool } { m [ pos ] . used || node . used , m [ pos ] . quiet || node . quiet , } } for _ , node := range c . graph . nodes { obj , ok := node . obj . ( types . Object ) if ! ok { continue } pos := c . prog . Fset ( ) . Position ( obj . Pos ( ) ) node . used = m [ pos ] . used node . quiet = m [ pos ] . quiet } }
// deduplicate merges objects based on their positions. This is done
// to work around packages existing multiple times in go/packages.
deduplicate merges objects based on their positions . This is done to work around packages existing multiple times in go / packages .