I am new to Golang and I wanted to learn by trying to create a logger with custom print format, so I have the following file structure:
logging (module named github.com/NikosGour/logging
-go.mod
-main.go (for testing the library)
-src
--lib.go
--models
---model.go
main.go
package main
import (
"fmt"
log "github.com/NikosGour/logging/src"
)
func main() {
fmt.Println("Kati allo")
log.Nikos("testing")
}
src/lib.go
package logging
import (
"fmt"
"github.com/NikosGour/logging/src/models"
)
func Nikos(str models.My_str) {
fmt.Println(str)
}
src/models/model.go
package models
type My_str string
This all works, but I wonder, is there a way of relativly importing the packages??
in src/lib.go
I would like to be able to do
import (
"fmt"
"./models"
)