Skip to content

cannot detect case when exporting the address of a struct member #27

@ljw7630

Description

@ljw7630
package main
import "fmt"

type Transaction struct {
	ID     int
	Status int
}

func main() {
	var txns []Transaction
	for i := 0; i < 10; i++ {
		txns = append(txns, Transaction{ID: i, Status: 0})
	}
	var ptr []*int
	for _, txn := range txns {
		fmt.Printf("Transaction ID: %d, Status addr: %p\n", txn.ID, &(txn.Status))
		ptr = append(ptr, &(txn.Status))
	}
}

running: exportloopref got no error

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions