# How to import a local module \*without\* re-downloading the imported module's dependencies?

**URL:** <https://forum.golangbridge.org/t/how-to-import-a-local-module-without-re-downloading-the-imported-modules-dependencies/34385>\
**Category:** Getting Help\
**Created:** [February 2, 2024, 2:42am UTC](https://forum.golangbridge.org/t/how-to-import-a-local-module-without-re-downloading-the-imported-modules-dependencies/34385 "2024-02-02T02:42:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![usr](https://forum.golangbridge.org/letter_avatar_proxy/v4/letter/u/f6c823/32.png) [@usr](https://forum.golangbridge.org/u/usr)\
**Post date:** [February 2, 2024, 2:42am UTC](https://forum.golangbridge.org/t/how-to-import-a-local-module-without-re-downloading-the-imported-modules-dependencies/34385/1 "2024-02-02T02:42:27Z")

</div>

I have a module `sample_project`, which has a `go.mod` like this:

```auto
module sample_project

go 1.21.6

replace local.mod/module_to_import => ../module_to_import

require (
	github.com/ethereum/go-ethereum v1.13.11
        ...
)

```

But `module_to_import` has a replacement for `github.com/ethereum/go-ethereum` because it uses the arbitrum version of ethereum-go, which has some arbitrum-related stuff (types, functions, etc).  
Here’s its `go.mod`:

```auto
module module_to_import

go 1.21.6

replace github.com/ethereum/go-ethereum => ./go-ethereum

require (
        ...
)

```

Now, this is sample\_project’s `main.go`:

```auto
import (
	...
	imported_utils "local.mod/module_to_import/utils"
)

```

The problem is that when doing `go run main.go`, it will attempt to download all the packages required by `module_to_import` and I get an error like this:

> module [github.com/ethereum/go-ethereum@latest](http://github.com/ethereum/go-ethereum@latest) found (v1.13.11), but does not contain package [github.com/ethereum/go-ethereum/arbitrum\_types](http://github.com/ethereum/go-ethereum/arbitrum_types)

I want to use the local package which resides in `../module_to_import/go-ethereum`. How can I do it?

---

<div class="post-metadata">

**Author:** ![freeformz](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/freeformz/32/77_2.png) [@freeformz](https://forum.golangbridge.org/u/freeformz)\
**Post date:** [February 2, 2024, 9:29pm UTC](https://forum.golangbridge.org/t/how-to-import-a-local-module-without-re-downloading-the-imported-modules-dependencies/34385/2 "2024-02-02T21:29:53Z")

</div>

I _think_ (but am not certain) that adding your own go-ethereum replacement will do the trick. Have tyou tried that?

---

<div class="post-metadata">

**Author:** ![alexcray](https://forum.golangbridge.org/letter_avatar_proxy/v4/letter/a/9e8a1a/32.png) [@alexcray](https://forum.golangbridge.org/u/alexcray)\
**Post date:** [February 3, 2024, 3:45am UTC](https://forum.golangbridge.org/t/how-to-import-a-local-module-without-re-downloading-the-imported-modules-dependencies/34385/3 "2024-02-03T03:45:25Z")

</div>

- For managing large projects with shared modules, consider package management tools like `pip` 's `--editable` flag or `replace` directive in `requirements.txt` to install local modules in editable mode, referencing their source directories directly.

---

<div class="post-metadata">

**Author:** ![system](https://forum.golangbridge.org/uploads/default/original/2X/5/5ad234f7c3dbc68b6cc72d338ce4f2973d9fd81c.png) [@system](https://forum.golangbridge.org/u/system)\
**Post date:** [May 3, 2024, 3:46am UTC](https://forum.golangbridge.org/t/how-to-import-a-local-module-without-re-downloading-the-imported-modules-dependencies/34385/4 "2024-05-03T03:46:14Z")

</div>

Closed on May 3, 2024, 3:46am UTC

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