GO learning - 005 Import anonymous and rename


GO learning - 005 Import anonymous and rename

1
2
3
4
5
6
7
8
9
10
11
package main

import (
"mymodule/src/GolangStudy/5-init/lib1"
"mymodule/src/GolangStudy/5-init/lib2"
)

func main() {
lib1.Lib1Test()
//lib2.Lib2Test()
}
1
2
lib1 function
Lib1Tese
1
2
3
4
5
6
7
8
9
10
11
package main

import (
"mymodule/src/GolangStudy/5-init/lib1"
_ "mymodule/src/GolangStudy/5-init/lib2"
)

func main() {
lib1.Lib1Test()
//lib2.Lib2Test()
}
1
2
3
lib1 function
lib2 function
Lib1Tese
1
2
3
4
5
6
7
8
9
10
11
package main

import (
x "mymodule/src/GolangStudy/5-init/lib1"
_ "mymodule/src/GolangStudy/5-init/lib2"
)

func main() {
x.Lib1Test()
//lib2.Lib2Test()
}
1
2
3
lib1 function
lib2 function
Lib1Tese

Author: Liang Junyi
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Liang Junyi !
  TOC