Skip to content

Fix Golang windows example - updated README.md test badge markdown.#651

Merged
vsvipul merged 6 commits intoactions:mainfrom
magnetikonline:fix-golang-windows-example
Mar 9, 2022
Merged

Fix Golang windows example - updated README.md test badge markdown.#651
vsvipul merged 6 commits intoactions:mainfrom
magnetikonline:fix-golang-windows-example

Conversation

@magnetikonline
Copy link
Copy Markdown
Contributor

@magnetikonline magnetikonline commented Sep 26, 2021

  • Fixed the cache paths for the Windows Golang example - the current example does not work correctly.
  • While in the area, chomped some markdown whitespace.

Also some recent 2022 updates(!):

@magnetikonline magnetikonline requested a review from a team as a code owner September 26, 2021 12:12
@magnetikonline
Copy link
Copy Markdown
Contributor Author

FWIW - tested this via a small composite Action I recently put together - noted that the current example doesn't map to a path that actually caches Golang build resources/files under Windows.

https://github.com/magnetikonline/action-golang-cache/blob/652619ab6a0bdfb5e4f50cddd1bda080327c44f8/action.yaml#L20-L37

@magnetikonline
Copy link
Copy Markdown
Contributor Author

Ping @brcrista (calling you out - as saw you on another recent PR!). 😄

- uses: actions/cache@v2
with:
path: |
%LocalAppData%\go-build
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I wonder why this doesn't work. Maybe we are doing variable expansion in the cache action somewhere instead of letting the OS do it.

I think that should change, but I'm fine with documenting the existing behavior for now. @magnetikonline do you have a before/after example I could look at to verify the fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @brcrista - I'll mock this up in a throwaway repository to show you.

When testing this - as part of https://github.com/magnetikonline/action-golang-cache I was always ending up with a zero byte cache - meaning the go-build path was not being found/hit. After this change, the cache would consistently have some size/volume.

I'll do another mock to show this behaviour.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you. That would be useful for tracking the underlying bug as well (I'll file that issue)

@magnetikonline magnetikonline requested a review from a team as a code owner February 24, 2022 05:28
@magnetikonline
Copy link
Copy Markdown
Contributor Author

magnetikonline commented Feb 25, 2022

Hello 👋 @brcrista.

I finally got around to putting together a POC to prove this change is needed.

See here: https://github.com/magnetikonline/golang-win-cache-test

  • A simple hello world Golang program.
  • Two workflows on push, running both on Windows, doing a cache - one using the old (current) and another doing the new (PR proposed) method.

See action runs of working/broken.

Also see screenshots here:

working

First screen shot shows a restored cache with a sizeable archive size. ☝️

broken

Second screen shot shows a restored cache with no actual content - just a archive file container (192 bytes) - this shows that %LocalAppData%\go-build is not being expanded to the correct home of ~\AppData\Local\go-build. ☝️

Thanks!

Edit: I've also noted that a grep for %AppData% across this project - the only other place we make mention of %AppData% is within the NPM path example, which I also suspect is wrong/incorrect/non-working.

@magnetikonline magnetikonline requested review from brcrista and removed request for a team February 25, 2022 00:11
@magnetikonline magnetikonline changed the title Fix Golang windows example Fix Golang windows example - updated README.md test badge markdown. Feb 25, 2022
@brcrista
Copy link
Copy Markdown
Contributor

I'll defer to @vsvipul on this now

@magnetikonline
Copy link
Copy Markdown
Contributor Author

Thanks @brcrista, @vsvipul - will await your feedback 👍

@magnetikonline
Copy link
Copy Markdown
Contributor Author

magnetikonline commented Mar 8, 2022

Friendly bump @vsvipul 😄

Copy link
Copy Markdown
Contributor

@vsvipul vsvipul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like %AppData% is not being correctly expanded to a path where the cache for Go is being stored. Only other place we use this is in deno. @jheysaav You might want to check the windows deno example if this is true for that as well, we can update the docs there as well.

LGTM.

@magnetikonline
Copy link
Copy Markdown
Contributor Author

Looks like %AppData% is not being correctly expanded to a path where the cache for Go is being stored. Only other place we use this is in deno.

Thanks @vsvipul 👍

I think you're on the money - have raised #762 cc: @jheysaav.

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

Successfully merging this pull request may close these issues.

3 participants