Skip to content

Commit

Permalink
internal/abi: add a dummy Go file for go mod vendor
Browse files Browse the repository at this point in the history
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 goccy/go-graphviz#37 for this
hack.

Updates #31
  • Loading branch information
hajimehoshi committed Sep 5, 2022
1 parent 0acfce6 commit 508c900
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors

//go:build dummy
// +build dummy

// This file exists purely to prevent the Go toolchain from stripping
// away the c source directories and files when `go mod vendor` is used
// to populate a `vendor/` directory of a project depending on this package.

package purego

import (
_ "github.com/ebitengine/purego/internal/abi"
)
8 changes: 8 additions & 0 deletions internal/abi/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors

//go:build dummy
// +build dummy

// Package abi is a dummy package that prevents go tooling from stripping the C dependencies.
package abi

0 comments on commit 508c900

Please sign in to comment.