When dealing with an alias of an alias, the actual underlying type of the source alias should be used.
28 lines
226 B
Go
28 lines
226 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
type A http.Header
|
|
|
|
func (a A) Test1() {
|
|
fmt.Println("test1")
|
|
}
|
|
|
|
type B A
|
|
|
|
func (b B) Test2() {
|
|
fmt.Println("test2")
|
|
}
|
|
|
|
func main() {
|
|
b := B{}
|
|
|
|
b.Test2()
|
|
}
|
|
|
|
// Output:
|
|
// test2
|