detached aeed57c

internal/abi: add a dummy Go file for go mod vendor (#32)

Before this change, the package `internal/abi` was ignored by `go mod vendor`
as there was no Go file there. Then building purego failed as `internal/abi`
didn't exist under the `vendor` directory.

This change fixes this issue by adding a dummy Go file to `internal/abi`
and adding an explicit import to it, but with a `dummy` build tag.

I referred a change https://github.com/goccy/go-graphviz/pull/37 for this
hack.

Updates #31
commit
aeed57cda74433391c1ebcd6c8ce5630cf944056
author
Hajime Hoshi · · 2022-09-05 07:56 UTC
committer
GitHub · · 2022-09-05 07:56 UTC
parent
0acfce6
signature
GPG Unverified4AEE18F83AFDEB23 The key is unknown
3 files · +38 -0
M .github/workflows/test.yml +15 -0
@@ -56,6 +56,21 @@ jobs:
5656 # Check cross-compiling Windows binaries.
5757 env GOOS=windows GOARCH=arm64 go build -v ./...
5858
59+ - name: go mod vendor
60+ run: |
61+ mkdir /tmp/vendoring
62+ cd /tmp/vendoring
63+ go mod init foo
64+ echo 'package main' > main.go
65+ echo 'import (' >> main.go
66+ echo ' _ "github.com/ebitengine/purego"' >> main.go
67+ echo ')' >> main.go
68+ echo 'func main() {}' >> main.go
69+ go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE
70+ go mod tidy
71+ go mod vendor
72+ go build -v .
73+
5974 - name: go test
6075 if: ${{ !startsWith(matrix.go, '1.15.') }} # TODO: Remove this condition after #27 is fixed.
6176 run: |
@@ -56,6 +56,21 @@ jobs:
56 # Check cross-compiling Windows binaries.56 # Check cross-compiling Windows binaries.
57 env GOOS=windows GOARCH=arm64 go build -v ./...57 env GOOS=windows GOARCH=arm64 go build -v ./...
58 58
59+ - name: go mod vendor
60+ run: |
61+ mkdir /tmp/vendoring
62+ cd /tmp/vendoring
63+ go mod init foo
64+ echo 'package main' > main.go
65+ echo 'import (' >> main.go
66+ echo ' _ "github.com/ebitengine/purego"' >> main.go
67+ echo ')' >> main.go
68+ echo 'func main() {}' >> main.go
69+ go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE
70+ go mod tidy
71+ go mod vendor
72+ go build -v .
73+
59 - name: go test74 - name: go test
60 if: ${{ !startsWith(matrix.go, '1.15.') }} # TODO: Remove this condition after #27 is fixed.75 if: ${{ !startsWith(matrix.go, '1.15.') }} # TODO: Remove this condition after #27 is fixed.
61 run: |76 run: |
A dummy.go +15 -0
@@ -0,0 +1,15 @@
1+// SPDX-License-Identifier: Apache-2.0
2+// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3+
4+//go:build dummy
5+// +build dummy
6+
7+// This file exists purely to prevent the Go toolchain from stripping
8+// away the C source directories and files when `go mod vendor` is used
9+// to populate a `vendor/` directory of a project depending on this package.
10+
11+package purego
12+
13+import (
14+ _ "github.com/ebitengine/purego/internal/abi"
15+)
@@ -0,0 +1,15 @@
1+// SPDX-License-Identifier: Apache-2.0
2+// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3+
4+//go:build dummy
5+// +build dummy
6+
7+// This file exists purely to prevent the Go toolchain from stripping
8+// away the C source directories and files when `go mod vendor` is used
9+// to populate a `vendor/` directory of a project depending on this package.
10+
11+package purego
12+
13+import (
14+ _ "github.com/ebitengine/purego/internal/abi"
15+)
A internal/abi/dummy.go +8 -0
@@ -0,0 +1,8 @@
1+// SPDX-License-Identifier: Apache-2.0
2+// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3+
4+//go:build dummy
5+// +build dummy
6+
7+// Package abi is a dummy package that prevents go tooling from stripping the C dependencies.
8+package abi
@@ -0,0 +1,8 @@
1+// SPDX-License-Identifier: Apache-2.0
2+// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3+
4+//go:build dummy
5+// +build dummy
6+
7+// Package abi is a dummy package that prevents go tooling from stripping the C dependencies.
8+package abi

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close