Skip to content

Commit

Permalink
build: fix build go version (#68)
Browse files Browse the repository at this point in the history
* build: fix build go version

* chore: fix checkout order
  • Loading branch information
ravisuhag authored Nov 1, 2024
1 parent ed9f2cf commit ac53404
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 63 deletions.
20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

13 changes: 13 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Raystack takes the security of our software products and services seriously.

If you believe you have found a security vulnerability in this project, you can report it to us directly using [private vulnerability reporting][].

- Include a description of your investigation of this project's codebase and why you believe an exploit is possible.
- POCs and links to code are greatly encouraged.
- Such reports are not eligible for a bounty reward.

**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**

Thanks for helping make GitHub safe for everyone.

[private vulnerability reporting]: https://github.com/raystack/meteor/security/advisories
29 changes: 29 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint
on:
push:
paths:
- "**.go"
- go.mod
- go.sum
pull_request:
paths:
- "**.go"
- go.mod
- go.sum

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test

on:
push:
branches:
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run unit tests
run: make test
38 changes: 0 additions & 38 deletions .github/workflows/verify.yaml

This file was deleted.

26 changes: 21 additions & 5 deletions term/brew.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ import (
"strings"
)

// IsUnderHomebrew checks whether the given binary is under the homebrew path.
func IsUnderHomebrew(binpath string) bool {
if binpath == "" {
// IsUnderHomebrew checks if a given binary path is managed under the Homebrew path.
//
// This function is useful to verify if a binary is installed via Homebrew
// by comparing its location to the Homebrew binary directory.
//
// Parameters:
// - path: The path of the binary to check.
//
// Returns:
// - A boolean value indicating whether the binary is located under the Homebrew path.
func IsUnderHomebrew(path string) bool {
if path == "" {
return false
}

Expand All @@ -23,10 +32,17 @@ func IsUnderHomebrew(binpath string) bool {
}

brewBinPrefix := filepath.Join(strings.TrimSpace(string(brewPrefixBytes)), "bin") + string(filepath.Separator)
return strings.HasPrefix(binpath, brewBinPrefix)
return strings.HasPrefix(path, brewBinPrefix)
}

// HasHomebrew check whether the user has installed brew
// HasHomebrew checks if Homebrew is installed on the user's system.
//
// This function determines the presence of Homebrew by looking for the "brew"
// executable in the system's PATH. It is useful to ensure Homebrew dependencies
// can be managed before executing related commands.
//
// Returns:
// - A boolean value indicating whether Homebrew is installed.
func HasHomebrew() bool {
_, err := exec.LookPath("brew")
return err == nil
Expand Down

0 comments on commit ac53404

Please sign in to comment.