Skip to content

Commit

Permalink
Merge pull request prometheus#369 from prometheus/superq/build_tag_check
Browse files Browse the repository at this point in the history
Add check for sysfs build tag
  • Loading branch information
SuperQ authored Jun 23, 2021
2 parents f418198 + e1d8b42 commit afad6d6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
steps:
- checkout
- run: make check_license
- run: ./scripts/check_build_tags.sh
- run: make fixtures
- run: make update_fixtures
- run: git diff --exit-code
Expand Down
12 changes: 12 additions & 0 deletions scripts/check_build_tags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

fail=0
while read -r f ; do
if ! grep -q '+build linux' "$f" ; then
echo "missing linux build tag: $f"
fail=1
fi
done < <(find sysfs -name '*.go')

exit "${fail}"

2 changes: 2 additions & 0 deletions sysfs/class_nvme.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package sysfs

import (
Expand Down
2 changes: 1 addition & 1 deletion sysfs/class_nvme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows
// +build linux

package sysfs

Expand Down
2 changes: 2 additions & 0 deletions sysfs/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

// Package sysfs provides functions to retrieve system and kernel metrics
// from the pseudo-filesystem sys.
package sysfs
2 changes: 2 additions & 0 deletions sysfs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package sysfs

import (
Expand Down
2 changes: 2 additions & 0 deletions sysfs/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux

package sysfs

import "testing"
Expand Down

0 comments on commit afad6d6

Please sign in to comment.