I’m new to Golang and I needed to study by making an attempt to create a logger with customized print format, so I’ve the next file construction:
logging (module named github.com/NikosGour/logging
-go.mod
-main.go (for testing the library)
-src
--lib.go
--models
---model.go
predominant.go
bundle predominant
import (
"fmt"
log "github.com/NikosGour/logging/src"
)
func predominant() {
fmt.Println("Kati allo")
log.Nikos("testing")
}
src/lib.go
bundle logging
import (
"fmt"
"github.com/NikosGour/logging/src/fashions"
)
func Nikos(str fashions.My_str) {
fmt.Println(str)
}
src/fashions/mannequin.go
bundle fashions
kind My_str string
This all works, however I ponder, is there a method of relativly importing the packages??
in src/lib.go
I would really like to have the ability to do
import (
"fmt"
"./fashions"
)