Skip to content

Goenv from working directory does not add pwd to GOPATH #3

Open

Description

@ChristopherRabotin

If one's working directory contains src, pkg and bin, then activating the environment won't correctly set the $GOPATH.

The solution I found was to edit goenv/activate and change the beginning of the export GOPATH line to be "export GOPATH=$GOPATH:pwd:...", such as the following:

export GOPATH=$GOPATH:`pwd`:/home/chris/.goenv/gotests

Important note: I'm new to Go, so maybe do I have my project structure wrong, or plenty of other stuff wrong. If so, please let me know!

Example tree:

.
├── __redacted__
├── goenv
│   └── activate
├── __redacted__
├── pkg
│   └── linux_amd64
│       └── scrapertests.a
├── src
│   └── scrapertests
│       └── test1.go
└── __redacted__

Activity

  1. ankitcharolia commented on Jan 2, 2024

    @ankitcharolia

    @ChristopherRabotin Kindly try this out https://github.com/ankitcharolia/goenv (ignore if it does not fit to your requirements)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions