Unable to build the project

Function Undefined while using it from same package

Unable to find out what is going wrong here.

Newly created 2 Files LibConfig and LibSQL, but LibConfig is undefined while calling a function in LibConfig from LibSQL.

NOTE: i want to install this complete project as package to local and use it in other projects

go.mod file here

module GitHub - pranavkv/golib_v1

go 1.18

require (

)

I can import all the functions from files other than LibConfig.

Please help to identify the issue

Files within the same directory are all part of the same package. Try removing the LibConfig. prefix

Hi @skillian Could you please let me know how we can install this locally and use it in other projects. Currently i had to commit all the changes to github and create a tag to use it in other projects. Anyway to build and install locally and use it ?

this is how i use it in another project

equire (
GitHub - pranavkv/golib_v1 v1.0.1
)

You could add to the other project’s go.mod file:

replace github.com/pranavkv/golib_v1 => ../golib_v1

Assuming your golib_v1 is beside your other project folder, for example:

./
β”œβ”€ golib_v1/
└─ other_project/
    └─ go.mod  ← This is where you add the replace for ../golib_v1
1 Like