--- layout: default title: using Go modules ---

# Using Go modules

## pull in repositories from your GOPATH

By default, Go modules will not look at `$GOPATH/src`, i.e. all packages passed to gokr-packer will be downloaded. If you had unpublished changes or packages in your `$GOPATH`, you can use the following steps to declare a Go module and pull it into the build:

    IMPORTPATH=github.com/stapelberg/gibot-i3
    (cd $(go env GOPATH)/src/${IMPORTPATH?} && GO111MODULE=on go mod init ${IMPORTPATH?})
    go mod edit -require ${IMPORTPATH?}@v0.0.0
    go mod edit -replace ${IMPORTPATH?}=$(go env GOPATH)/src/${IMPORTPATH?}

## pull in local repositories

Please see https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive.