Golang ProgramsGolang Programs

How to import and use packages of the same name?

Below is an example to import fmt package via 3 different precedence. In this way you can also import and use different packages of the same name in Go language.

package main

import l "fmt"
import m "fmt"
import n "fmt"

func main() {
    l.Println("FMT import l")
	m.Println("FMT import m")
	n.Println("FMT import n")
C:\golang\codes>go run example26.go
FMT import l
FMT import m
FMT import n