Title: Use of `rel/` dir in workdir makes workdir unclean · Issue #65 · function61/turbobob · GitHub
Open Graph Title: Use of `rel/` dir in workdir makes workdir unclean · Issue #65 · function61/turbobob
X Title: Use of `rel/` dir in workdir makes workdir unclean · Issue #65 · function61/turbobob
Description: Problem Scenario: compile Go app. Go auto-embeds Git metadata such as workdir clean status. function61/gokit/app/dynversion propagates this to version number as -dev suffix to indicate all builds are dev versions: https://github.com/func...
Open Graph Description: Problem Scenario: compile Go app. Go auto-embeds Git metadata such as workdir clean status. function61/gokit/app/dynversion propagates this to version number as -dev suffix to indicate all builds a...
X Description: Problem Scenario: compile Go app. Go auto-embeds Git metadata such as workdir clean status. function61/gokit/app/dynversion propagates this to version number as -dev suffix to indicate all builds a...
Opengraph URL: https://github.com/function61/turbobob/issues/65
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use of `rel/` dir in workdir makes workdir unclean","articleBody":"## Problem\r\n\r\nScenario: compile Go app. Go auto-embeds Git metadata such as workdir clean status.\r\n\r\n`function61/gokit/app/dynversion` propagates this to version number as `-dev` suffix to indicate all builds are dev versions:\r\n\r\nhttps://github.com/function61/gokit/blob/f6c12a3fbe5e9b101501b9ee9c0709258543e1de/app/dynversion/version.go#L47-L49\r\n\r\n\r\n## Partial fix\r\n\r\nShipped 7785765328d9e756e9ea24f42e5f1012e8b460b0 to at least not make all GitHub workflow -initiated builds not auto-mark the workdir as unclean.\r\n\r\n\r\n## Footgun\r\n\r\nSince Git does not track directories, the fact that say [`buildkit-golang` creates `rel/` directory before build](https://github.com/function61/buildkit-golang/blob/41efd88da429006898af8c3a64b9f58371c8843d/build-go-project.sh#L166-L169) does not make the workdir unclean from Git perspective.\r\n\r\nBut let's say we have app we want to cross-compile both for:\r\n\r\n1. amd64\r\n2. riscv64\r\n\r\nWhen we start building item 1 the workdir is clean because `rel/` dir is empty at start of build.\r\n\r\nNow when we start building item 2 the workdir is unclean because the item 1 is in there.\r\n\r\nResult:\r\n\r\n| Build | Version |\r\n|---|---|\r\n| amd64 | 1.2.3 |\r\n| riscv64 | 1.2.3-dev |\r\n\r\nThat's hell of a footgun.\r\n\r\nFor consistency we'd probably like to create the `rel/` directory and drop some dummy file in there, better the possible `-dev` suffix to apply to all executables instead of `n \u003e 1`. This would be worsened by building those in parallel, then it would be nondeterministic which versions are marked dev..\r\n\r\nThis `rel/` dir affecting workdir cleanliness state could be mitigated by `.gitignore`'ing the dir, but am not sure if it's nice to impose that to every project.\r\n\r\n## Have the build result directory be outside of the VCS workdir?\r\n\r\nThis would solve the footgun thing. How to do this properly without adding too much complexity to all users?\r\n\r\n\r\n## Would we realistically be able to maintain clean workdirs in ALL situations?\r\n\r\nThere are concepts like code generation which by design make the normal build look like it's always unclean.\r\n\r\nMaybe it'd be OK to accept the fact that with some projects it's not pragmatic to maintain the clean state.","author":{"url":"https://github.com/joonas-fi","@type":"Person","name":"joonas-fi"},"datePublished":"2024-11-19T11:12:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/65/turbobob/issues/65"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:148c2e34-4ce4-8fce-e674-e28eb4545921 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 919A:12F25:43D261:612861:6A4BC7C8 |
| html-safe-nonce | 06b6d5f72ac7791937367999f5b373e9a488d1e9a6dd4e789b701da79fbe9f38 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTlBOjEyRjI1OjQzRDI2MTo2MTI4NjE6NkE0QkM3QzgiLCJ2aXNpdG9yX2lkIjoiNzI1NDAxODExNzY3NTUwMTUxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e8d8ed61640976e132f49eeaa95ed697b7c7c5ff5a1e4955650697e2f0ba4402 |
| hovercard-subject-tag | issue:2671792021 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/function61/turbobob/65/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ddf7b34818fc0299858cfb03b5c7320acbc41e90c34cee5d5493356af18eaaf5/function61/turbobob/issues/65 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ddf7b34818fc0299858cfb03b5c7320acbc41e90c34cee5d5493356af18eaaf5/function61/turbobob/issues/65 |
| og:image:alt | Problem Scenario: compile Go app. Go auto-embeds Git metadata such as workdir clean status. function61/gokit/app/dynversion propagates this to version number as -dev suffix to indicate all builds a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | joonas-fi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 14aa00ce5bdb34d0eefb5facbffd7de9e144c688d8a93ef8df902d5f94b51dd7 |
| turbo-cache-control | no-preview |
| go-import | github.com/function61/turbobob git https://github.com/function61/turbobob.git |
| octolytics-dimension-user_id | 22049800 |
| octolytics-dimension-user_login | function61 |
| octolytics-dimension-repository_id | 146426259 |
| octolytics-dimension-repository_nwo | function61/turbobob |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 146426259 |
| octolytics-dimension-repository_network_root_nwo | function61/turbobob |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 58b8f89190447502561829f30862aa0a99d53367 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width