New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/synic/magex

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/synic/magex

  • v0.0.6
  • Source
  • Go
  • Socket score

Version published
Created
Source

MAGEX

Extension functions and utilities to augment the Go mage build system: https://magefile.org/

Functions

ModuleVersion

Pulls the version of a given module from the go.mod file. This is intended to be used in pair with MaybeInstallTool so that the go.mod file can be the source of truth for a command line utility. For example, templ (https://templ.guide) is a module that you import in your code, AND a cli codegen utility, and then need to be the same version. Example:

func Codegen() error {
  version, err := magex.ModuleVersion("github.com/a-h/templ")

  if err != nil {
    return err
  }

  path, err := magex.MaybeInstallTool(
    "templ", "github.com/a-h/templ/cmd/templ", version,
  )

  if err != nil {
    return err
  }

  return sh.Run(path, "generate")
}
MaybeInstallTool

Checks to see if a go command line tool is installed, and if it's not, it installs it.

func Dev() error {
  path, err := magex.MaybeInstallTool(
    "air", "github.com/cosmtrek/air", "v1.49.0",
  )

  if err != nil {
    return err
  }

  return sh.RunV(path)
}
MaybeInstallToolToDestination

Checks to see if a go command line tool exists at the given location. If not, it installs it. Useful if you want to install to ./bin and avoid changing the host GOPATH.

func Dev() error {
  path, err := magex.MaybeInstallToolToDestination(
    "air", "github.com/cosmtrek/air", "v1.49.0", "bin",
  )

  if err != nil {
    return err
  }

  return sh.RunV(path)
}

FAQs

Package last updated on 17 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc