Answer the question
In order to leave comments, you need to log in
Golang compiler doesn't see packages imported from local package?
There is a small written API on GO, pq, mux and pbkdf2 were imported and the project compiled and ran normally, but there was a need for Redis after go mod init X and installing modules, the project throws an error
resources\users.go:10:5: cannot find package when compiling
models\db_con.go:6:2: cannot find package
utils
\pass_hash.go:5:2: cannot find package
api/
models/
db_con.go
models.go
resources/
users.go
templates/
...
utils/
esm.go
pass_hash.go
settings.go
main.go
go.mod
package resources
import (
"encoding/json"
"fmt"
"net/http"
//"context"
"net"
"time"
"github.com/go-redis/redis/v8"
//"github.com/google/uuid"
"../../api/utils"
"../../api/models"
"../../api"
)
......
package models
import (
"fmt"
"database/sql"
_"github.com/lib/pq"
"../../api"
)
.....
package utils
import (
"fmt"
"golang.org/x/crypto/pbkdf2"
"crypto/sha256"
)
....
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question