M
M
Marat Nagayev2021-01-09 20:26:45
go
Marat Nagayev, 2021-01-09 20:26:45

How to import a package from a subpackage?

There is a main package with a module subpackage.
That is, in the project folder there are files
main.go and module/module.go
How do I understand how to import a module from main, but vice versa?
in module.go I write
import "../main" does not work

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
index0h, 2021-01-09
@nagayev

main cannot be imported

M
Marat Nagayev, 2021-01-09
@nagayev

Found a solution:
make another subpackage
a function from this subpackage can be used from in the main module, and in another subpackage.

F
Froggyweb, 2017-04-07
@Froggyweb

Canvas https://habrahabr.ru/post/111308/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question