npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hxjiang-go

v1.0.26

Published

A hxjiang built go

Readme

npm go

You can download the go and go tool chain using npm by

npm install -g hxjiang-go-{OS}-{ARCH}

To differentiate between Go and npm installed Go, the installed Go binary is called hxjiang-go.

hongxiangjiang@MacBookPro hxjiang-go % which hxjiang-go
/Users/hongxiangjiang/.nvm/versions/node/v22.18.0/bin/hxjiang-go
hongxiangjiang@MacBookPro hxjiang-go % hxjiang-go env GOROOT
/Users/hongxiangjiang/.nvm/versions/node/v22.18.0/lib/node_modules/hxjiang-go-{OS}-{ARCH}/go

How it works?

package.json allow developers to add binaries (including pre-compiled binaries), when developer install a cerrtain package using npm install -g ${package}, all the binaries will be avaialble in node.js bin dir and all the package code will be available in lib subdir.

Why is the go smart enough to know the GOROOT?

If the go is not built from source, the go will try to figure out the GOROOT by following:

  • GOROOT env var.
  • ../..
  • ../../..

After installing the go from npm, how did go figure out where is the GOROOT?

 ~/Desktop/codebase/ ls -l $(which hxjiang-go) 
lrwxr-xr-x  1 hxjiang  primarygroup  53 Aug  8 15:37 /Users/hxjiang/.nvm/versions/node/v20.18.0/bin/hxjiang-go -> ../lib/node_modules/hxjiang-go-darwin-arm64/go/bin/go

NPM create a symbolic in node bin dir (which is part of PATH) which pointing to the go command in the lib dir. So go command can follow ../.. to figure out GOROOT.

Why there is no tag in this git repo?

npm use the version information from the package.json. But I think it would be more clear if we have a tag in git repo as well.

TODO(hxjiang): is there a way to make it required to have both git tag and npm package version the same?

Having duplicate go toolchain for all OS x ARCH is not ideal. Having user downloading go follow npm package hxjiang-go-${OS}-${ARCH} is not ideal. what can we do to improve this.

I have done some research on this topic. The most promising result is, using optionalDependencies with folder / packages struture like this:

The parent level package is hxjiang-go and the go/bin/go and go/bin/gofmt are a wrapper which pointing to the actual implementation.

The actual go and gofmt binary is available as a dependency package of hxjiang-go.

hxjiang-go
|--- package.json
|--- go
|    |--- bin
|    |    |--- go (wrapper)
|    |    |--- gofmt (wrapper)
|    |--- api
|    |    ......
|    |--- pkg
|    |    ......
|--- hxjiang-go-darwin-arm64
|    |---go
|    |    |--- bin
|    |         |--- go 
|    |         |--- gofmt 
|--- hxjiang-go-darwin-amd64
|    |---go
|    |    |--- bin
|    |         |--- go 
|    |         |--- gofmt 
|--- hxjiang-go-linux-arm64
|    |---go
|    |    |--- bin
|    |         |--- go 
|    |         |--- gofmt 
|--- hxjiang-go-linux-arm64
|    |---go
|    |    |--- bin
|    |         |--- go 
|    |         |--- gofmt 
|--- hxjiang-go-OS-ARCH
.......

What is optional dependency and why?

optional dependency allow package developer to add dependencies to your package. The dependency package can specify OS and ARCH. When user install go using npm install -g hxjiang-go, npm dynamically figureout which OS and ARCH is available for user's workstation. So only one of the distribution will be installed.

However, the binary of the optional dependency is not added to the node module bin dir automatically. That's why the wrapper is needed.

The wrapper will automatically choose which go to run. Another solution is to have a post installation script which will replace the wrapper with the actual go. Like a mv hxjiang-go-OS-ARCH/go/bin/* go/bin/.

All these are community solution raised at esbuild.

However, this approach need more time to investigate how NPM works and how esbuild write their post installation script. But I believe this should be doable.