GORM Playground Link

https://github.com/go-gorm/playground/pull/460

Description

If two tables have the same column names like id and name, once we perform the JOIN query with a junction table in between, we see that the library does not populate the right value into the right struct. This happens due to how value is scanned back to the struct.

Comment From: Joker666

Fixed with https://github.com/go-gorm/gorm/pull/5143

Comment From: Joker666

This issue was fixed by https://github.com/go-gorm/gorm/pull/5143 but however, @jinzhu modified my commit to be more concise which resulted in a bug. That's why opening this issue again and going to send PR to fix the bug as well.

I also added a new playground PR https://github.com/go-gorm/playground/pull/460 which has more robust test cases so that test will fail in case this bug regresses again