How to find your own package by using the moudle function of go1.11

I initialized go.mod in the Gopath/src directory and wrote a package myself, but always compiled an error, but there was no problem using the package on github


:

Code:
go.mod:

package config

import (
    "fmt"
)

func Config() {
    fmt.Println("mmmmmmmmmmm")
}

compilation keeps telling me that I can"t find the config package, but I can"t do it without moudle

Jan.19,2022

  1. module main this is definitely an inappropriate way to write
  2. The reason for the error in
  3. is that you define module main , but when you import config, a subpackage under the main package, the path is wrong main/config
  4. .

I have this problem, too, if config is only a subpackage of the current project, and if it is a package of the same level as main in the src directory.
the solution is to upload the config package to github and import it.
if config is a private package, you can only import it according to the private git path, but this method seems to have a problem with go get.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31b6b-2bdd1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31b6b-2bdd1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?