Andrii Radkevych
Andrii Radkevych

Reputation: 3442

Any way to prevent using project name from go.mod file in import path

import (
    "fmt"
    "golang/pkg/closure"
    "golang/pkg/player"
    "golang/pkg/slices"
    "golang/pkg/user"
)

Above you can see my imports in main package. On same level with main.go file , I have folder pkg , where I hold my packages and file go.mod

module golang

go 1.18

How can make it working same way but without using golang/ prefix ?

Upvotes: 0

Views: 157

Answers (1)

user19563732
user19563732

Reputation:

There is not a way to remove the module path from an import path.

You can, however, remove the pkg folder from your directory structure and import paths.

Upvotes: 1

Related Questions