Import functions between documents

Good morning, I would like to know how you can call functions that I have in a different document, inside the main.go

groups
-----controllers
-------usersControllers.go
main.go

file main.go

package main

import (
	"./groups/controllers"
	"github.com/gorilla/mux"
	"log"
	"net/http"
	"time"
)

terminal debug

build command-line-arguments: cannot find module for path /C/Users/YeisonQ/Documents/Yeison/Backup_Yeison/Trabajos/Api_fullrest_scim_go/groups/controllers

thanks for your attention

1 Like

I believe if you are using go modules then you need to start the import path with the module name. For example, if the name of your module was module github.com/yeisonqb/cool_application then your import path would be github.com/yeisonqb/cool_application/groups/controllers

if you are not using modules then your import path will start at your $GOPATH/src directory. You will then need to traverse down to the root folder of your application.

I hope that helps.

thanks, it worked

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.