Comments (11)
Can this issue be closed now?
from cascadia.
Here is my WIP formula, originally created with brew create --go https://github.com/suntong/cascadia/archive/refs/tags/v1.2.6.zip
:
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Cascadia < Formula
desc "Go cascadia package command-line CSS selector"
homepage "https://github.com/suntong/cascadia"
url "https://github.com/suntong/cascadia/archive/refs/tags/v1.2.6.zip"
sha256 "d46fd0b91aabab9789c093286dccae564ece9095bf74b6bc92e865364845cfbd"
license "MIT"
head "https://github.com/suntong/cascadia.git", branch: "master"
bottle do
end
depends_on "go" => :build
def install
# ENV.deparallelize # if your formula fails when building in parallel
system "go", "build", *std_go_args(ldflags: "-s -w")
end
test do
# `test do` will create, run in and delete a temporary directory.
#
# This test will fail and we won't accept that! For Homebrew/homebrew-core
# this will need to be a test that verifies the functionality of the
# software. Run the test with `brew test cascadia`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
system "false"
end
end
When running brew install --debug cascadia
I get the following error though:
==> go build -ldflags=-s -w
Last 15 lines from /Users/devalias/Library/Logs/Homebrew/cascadia/01.go:
2023-01-08 01:25:31 +0000
go
build
-trimpath
-o=/usr/local/Cellar/cascadia/1.2.6/bin/cascadia
-ldflags=-s -w
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
I created the following issue about the missing go.mod
file:
from cascadia.
According to this StackOverflow, it seems we can work around the missing go.mod
file in the interim by setting GO111MODULE=off
:
Setting that in the above homebrew formula like this:
def install
ENV['GO111MODULE'] = "off"
system "go", "build", *std_go_args(ldflags: "-s -w")
end
Then leads to the following new errors when building with brew install --debug cascadia
:
==> go build -ldflags=-s -w
Last 15 lines from /Users/devalias/Library/Logs/Homebrew/cascadia/01.go:
cascadia_main.go:19:2: cannot find package "github.com/PuerkitoBio/goquery" in any of:
/usr/local/Cellar/go/1.19.4/libexec/src/github.com/PuerkitoBio/goquery (from $GOROOT)
/Users/devalias/Library/Caches/Homebrew/go_mod_cache/src/github.com/PuerkitoBio/goquery (from $GOPATH)
cascadia_main.go:20:2: cannot find package "github.com/andybalholm/cascadia" in any of:
/usr/local/Cellar/go/1.19.4/libexec/src/github.com/andybalholm/cascadia (from $GOROOT)
/Users/devalias/Library/Caches/Homebrew/go_mod_cache/src/github.com/andybalholm/cascadia (from $GOPATH)
cascadia_cliDef.go:13:2: cannot find package "github.com/mkideal/cli" in any of:
/usr/local/Cellar/go/1.19.4/libexec/src/github.com/mkideal/cli (from $GOROOT)
/Users/devalias/Library/Caches/Homebrew/go_mod_cache/src/github.com/mkideal/cli (from $GOPATH)
cascadia_cliDef.go:15:2: cannot find package "github.com/mkideal/cli/ext" in any of:
/usr/local/Cellar/go/1.19.4/libexec/src/github.com/mkideal/cli/ext (from $GOROOT)
/Users/devalias/Library/Caches/Homebrew/go_mod_cache/src/github.com/mkideal/cli/ext (from $GOPATH)
cascadia_main.go:22:2: cannot find package "golang.org/x/net/html" in any of:
/usr/local/Cellar/go/1.19.4/libexec/src/golang.org/x/net/html (from $GOROOT)
/Users/devalias/Library/Caches/Homebrew/go_mod_cache/src/golang.org/x/net/html (from $GOPATH)
Looking at some of the other go-based formulae on Hombrew:
It seems as though we may be able to provide the dependencies using the go_resource
syntax..
Though then I found this, which suggests that it's deprecated:
from cascadia.
It seems like the go.mod
file I created from go mod init github.com/suntong/cascadia
+ go mod tidy
in the following PR makes it work:
As a hacky interim until that gets properly fixed, we can then seemingly change the install
block of the formula to this:
def install
# go mod init/tidy are needed until https://github.com/suntong/cascadia/issues/13 is fixed
system "go", "mod", "init", "github.com/suntong/cascadia"
system "go", "mod", "tidy"
system "go", "build", *std_go_args(ldflags: "-s -w")
end
from cascadia.
Raised a PR to Homebrew to add this formula:
from cascadia.
Yes, GO111MODULE=off
is the way I do the build.
I'll hold off turning it on as long as I could, as I personally believe it'll bring more mess to my simple project than doing it good. Huge projects with tons of dependencies is another different story.
As a hacky interim until that gets properly fixed, we can then seemingly change the
install
block of the formula to this:
Yes, please do. thx.
from cascadia.
I'll hold off turning it on as long as I could, as I personally believe it'll bring more mess to my simple project than doing it good.
To be honest, it's a tiny single file change, and super simplistic; with seemingly a single command required to keep it up to date if you change any dependencies.. i'd recommend maybe just merging the PR where I submitted it and being modern/compliant:
from cascadia.
Looks like the changes from #14 will land in v1.2.7
:
Updated the PR to submit the homebrew formula to use that version in Homebrew/homebrew-core@b6e643b
(#120044)
from cascadia.
Can this issue be closed now?
from cascadia.
Generally speaking it should probably stay open until this PR lands:
But as project owner, I guess that's really up to you.
from cascadia.
Yup!
Was merged in: Homebrew/homebrew-core@52e7efb
@0xdevalias @suntong, thanks for your contribution to Homebrew! 🎉 🥇
Without awesome contributors like you, it would be impossible to maintain Homebrew to the high level of quality users have come to expect. Thank you!!!!
Originally posted by @chenrui333 in Homebrew/homebrew-core#120044 (comment)
from cascadia.
Related Issues (8)
- select a block by its index ? HOT 6
- error: go: go.mod file not found in current directory or any parent directory HOT 8
- make better use of stderr HOT 5
- Add option to extract individual values raw HOT 25
- Undefined "github.com/go-easygen/cli".DenseNormalStyle HOT 3
- Provide text output for none-block selection mode HOT 13
- Add contributors HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cascadia.