го пакетов? не могу понять как определить исходный тип 
                  
                  
                  
                  
                  
                  к примеру, есть
                  
                  
                  
                  
                  
                  
                  
                  
                  package custom
                  
                  
                  
                  
                  
                  type Custom []string
                  
                  
                  
                  
                  
                  package other
                  
                  
                  type CustomStruct {
                  
                  
                      CustomField custom.Custom
                  
                  
                  }
                  
                  
                
Вы уверены?
https://golang.org/pkg/go/types/#Named.Underlying
x := someFunction() // Some value of an unknown type is stored in x now switch x := x.(type) { case bool: fmt.Printf("boolean %t\n", x) // x has type bool case int: fmt.Printf("integer %d\n", x) // x has type int case string: fmt.Printf("pointer to boolean %s\n", x) // x has type string default: fmt.Printf("unexpected type %T\n", x) // %T prints whatever type x is }
Обсуждают сегодня