Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to ignore certain folders? #304

Open
cwrau opened this issue Apr 16, 2024 · 8 comments
Open

how to ignore certain folders? #304

cwrau opened this issue Apr 16, 2024 · 8 comments

Comments

@cwrau
Copy link

cwrau commented Apr 16, 2024

In gitlab CI we'd like to cache the go packages, via GOPATH=$CI_PROJECT_DIR/.go, but this tool then fails to run , as it tries to format .go/pkg/mod/github.com/onsi/ginkgo/[email protected]/integration/_fixtures/reporting_fixture/malformed_sub_package/malformed_sub_package_suite_test.go:15:1: expected declaration, found NO_COMPILE

Is there a way to ignore a folder? Or maybe generally GOPATH? Or stuff inside hidden directories?

@kolyshkin
Copy link

Seems like a duplicate of #250

@kolyshkin
Copy link

@cwrau you can probably move GOPATH out of $CWD (or vise versa) to fix the issue you're having.

@cwrau
Copy link
Author

cwrau commented Jul 14, 2024

@cwrau you can probably move GOPATH out of $CWD (or vise versa) to fix the issue you're having.

Actually not, as I'm in CI in gitlab and can only cache folders inside the project directory, which is the git tree, which is the right where the main go.mod lies 😅

@kolyshkin
Copy link

@cwrau it's hard to figure out your setup with the info provided. Can you give a link to your ci setup/scripts?

@cwrau
Copy link
Author

cwrau commented Jul 15, 2024

@cwrau it's hard to figure out your setup with the info provided. Can you give a link to your ci setup/scripts?

It's nothing special, I'm checking out the repo, with go.mod at the root, set GOPATH to $CI_PROJECT_DIR/.go so I can cache it, and run gofumpt.

Currently I'm already workarounding this with gofumpt -w api cmd pkg test, but this is inflexible in case we add new directories.

I'd rather do the opposite and exclude $GOPATH instead of including everything else.

@kolyshkin
Copy link

I'm still missing some bits information here so I have to guess/assume/imagine a few things. Not seeing the full picture makes it harder to help, and might render my answers less useful (or just plain wrong). Surely, I can ask more questions about your setup details (which might be obvious to you but not me), but this is not the place to do so.

But let's go one step back.

@cwrau you can probably move GOPATH out of $CWD (or vise versa) to fix the issue you're having.

Actually not, as I'm in CI in gitlab and can only cache folders inside the project directory, which is the git tree, which is the right where the main go.mod lies 😅

I believe you still can do that (move .go out of your source tree), and there are many ways to do so:

  1. Use GIT_CLONE_PATH (https://docs.gitlab.com/ee/ci/runners/configure_runners.html#custom-build-directories).
  2. Move the checked out sources to a different directory.
  3. Use GIT_STRATEGY:none to disable automatic checkout, and run git clone manually.
    ...

@cwrau
Copy link
Author

cwrau commented Jul 16, 2024

I'm still missing some bits information here so I have to guess/assume/imagine a few things. Not seeing the full picture makes it harder to help, and might render my answers less useful (or just plain wrong). Surely, I can ask more questions about your setup details (which might be obvious to you but not me), but this is not the place to do so.

But let's go one step back.

@cwrau you can probably move GOPATH out of $CWD (or vise versa) to fix the issue you're having.

Actually not, as I'm in CI in gitlab and can only cache folders inside the project directory, which is the git tree, which is the right where the main go.mod lies 😅

I believe you still can do that (move .go out of your source tree), and there are many ways to do so:

  1. Use GIT_CLONE_PATH (docs.gitlab.com/ee/ci/runners/configure_runners.html).
  2. Move the checked out sources to a different directory.
  3. Use GIT_STRATEGY:none to disable automatic checkout, and run git clone manually.
    ...

Of those three, number one would be the most likely one we'd be inclined to try, but I think we'd rather wait on #250, however I managed to miss that issue before creating this one 😅

But that does sound like it would work 👍

@mvdan
Copy link
Owner

mvdan commented Jul 24, 2024

Indeed this is a duplicate of #250, as @kolyshkin points out. See #250 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants