https://github.com/dennwc/flatpak-go-mod
CLI tool to generate Flatpak sources directives for Go modules
https://github.com/dennwc/flatpak-go-mod
Last synced: 3 months ago
JSON representation
CLI tool to generate Flatpak sources directives for Go modules
- Host: GitHub
- URL: https://github.com/dennwc/flatpak-go-mod
- Owner: dennwc
- License: mit
- Created: 2023-01-13T11:39:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-05T18:09:11.000Z (6 months ago)
- Last Synced: 2025-03-18T08:11:21.622Z (3 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flatpak Go modules helper
This CLI tool generates Flatpak sources directives for Go modules.
It helps avoid exposing network access to Flatpak build step, which is one of the requirements for publishing to Flathub.
## Usage
```bash
go run github.com/dennwc/flatpak-go-mod@latest ./path/to/your/project
```It will generate following files: `go.mod.yml` (or `go.mod.json`) and `modules.txt`.
Contents of `go.mod.yml` (or `go.mod.json`) should be copied into `sources` directives of Flatpak YAML.
These directives will populate `./vendor` during Flatpak build with all dependencies of your project,
downloading them directly from Go modules mirror.The `modules.txt` file should be copied into your Flatpak directory, which will be added to `./vendor` directory during Flatpak build as well.
Then, build your Go project as usual. It should detect `vendor` directory automatically.
You can also pass `-mod=vendor` to force vendoring mode during build.## Output
### YAML
```yaml
# Workaround for Go modules generated by github.com/dennwc/flatpak-go-mod
- type: file
path: modules.txt
dest: vendor
- type: archive
url: https://proxy.golang.org/golang.org/x/mod/@v/v0.7.0.zip
strip-components: 3
dest: vendor/golang.org/x/mod
sha256: 24abd1db13329873d72034dc27efad09cbc37d39cf28b8ff7bb3c2adc8eedef7
```### JSON
```json
[
{
"type": "file",
"path": "modules.txt",
"dest": "vendor"
},
{
"type": "archive",
"url": "https://proxy.golang.org/golang.org/x/mod/@v/v0.7.0.zip",
"strip-components": 3,
"dest": "vendor/golang.org/x/mod",
"sha256": "24abd1db13329873d72034dc27efad09cbc37d39cf28b8ff7bb3c2adc8eedef7"
}
]
```## Options
- `line-pref` customizes indentation in YAML/JSON file
- `dest-pref` sets a prefix for `sources.dest` paths in YAML/JSON file
- `json` changes the output format to JSON instead of YAML## License
MIT