为什么会出现“接口转换:接口为int32”,用于将列表整数元素转换为字符串?

New to Go...I wrote a program to remove duplicate integers stored in a list. When I run the following test for the removeDuplicates function, I get the following error which points to this line: testString += strconv.Itoa(e.Value.(int)) in linked_test.go. Why is this and how do I fix it? I store integers in testList and fetch them with e.Value and typecast with .(int).

panic: interface conversion: interface is int32, not int [recovered]
    panic: interface conversion: interface is int32, not int

linked_test.go

package linked

import (
    "container/list"
    "strconv"
    "testing"
)

func TestDuplicates(t *testing.T) {
    var (
        testList           = list.New()
        exampleList        = list.New()
        testString  string = ""
    )
    testList.PushBack(1)
    testList.PushBack(2)
    testList.PushBack(3)
    testList.PushBack(2)
    exampleList = removeDuplicates(testList)
    for e := exampleList.Front(); e.Next() != nil; e = e.Next() {
        testString += strconv.Itoa(e.Value.(int))
    }
    if testString != "123" {
        t.Fatalf("removeDuplicates failed")
    }
}

linked.go

package linked

import (
    "container/list"
    "strconv"
    "strings"
)

func removeDuplicates(l *list.List) *list.List {
    var newList = list.New()
    var dupString string = ""
    for e := l.Front(); e.Next() != nil; e = e.Next() {
        if strings.Index(dupString, strconv.Itoa(e.Value.(int))) == -1 {
            dupString += strconv.Itoa(e.Value.(int))
        }
    }
    for _, c := range dupString {
        newList.PushBack(c)
    }
    return newList
}

rune is aliased to int32,

for _, c := range dupString {
    newList.PushBack(c) // c is a rune aka int32
}

is pushing int32s, while int is aliased to int64 on 64bit CPUs, so one way to do it is to just force the type:

for _, c := range dupString {
    newList.PushBack(int(c))
}