Skip to content

Commit

Permalink
shiny/driver/mtldriver: add cgo build constraint
Browse files Browse the repository at this point in the history
The mtldriver package requires cgo even though it itself doesn't import
"C" directly. This is because it imports Go packages that require cgo.

So, add the 'cgo' build constraint to mtldriver too, since it can't do
its job without it.

This fixes 'build constraints exclude all Go files' build errors when
CGO_ENABLED is set to 0. Uncovered incidentally while cross-compiling
to another platform, which happens to disable cgo by default.

For golang/go#61698.

Change-Id: I298018e79a5e93a55d39bda2b253686cde8b5e8a
Reviewed-on: https://go-review.googlesource.com/c/exp/+/516677
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
dmitshur authored and gopherbot committed Aug 7, 2023
1 parent 38c65eb commit 050eac2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion shiny/driver/mtldriver/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin
//go:build darwin && cgo

package mtldriver

Expand Down
2 changes: 1 addition & 1 deletion shiny/driver/mtldriver/mtldriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin
//go:build darwin && cgo

// Package mtldriver provides a Metal driver for accessing a screen.
//
Expand Down
2 changes: 1 addition & 1 deletion shiny/driver/mtldriver/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin
//go:build darwin && cgo

package mtldriver

Expand Down
2 changes: 1 addition & 1 deletion shiny/driver/mtldriver/texture.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin
//go:build darwin && cgo

package mtldriver

Expand Down
2 changes: 1 addition & 1 deletion shiny/driver/mtldriver/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin
//go:build darwin && cgo

package mtldriver

Expand Down

0 comments on commit 050eac2

Please sign in to comment.