- cli
- css selector
- tablewriter
- 2d array sort
- go channel
- go module
- goquery documentation
- css test env
- go binary size reduce
- go sync map to map
- go race detector
- json validator
- json to map
- regex square blanket
- online regex
- codecoverage
- cross compile
- fetch torrent urls from 추천 토렌트 사이트 but it is not a good approach.
Click to toggle contents of `code`
// Function to update the URL with a maximum number of retries
func updateTorrentURL(key string, url string, maxRetries int, wg *sync.WaitGroup, resultChan chan<- struct {
key string
url string
}) {
defer wg.Done()
for i := 0; i < maxRetries; i++ {
if checkURL(url) {
resultChan <- struct {
key string
url string
}{key, url}
return
}
url = incrementURL(url)
}
resultChan <- struct {
key string
url string
}{key, ""} // Indicate failure with an empty string
}
This guide walks you through setting up a local Homebrew tap and creating a formula to distribute your Go-based application.
Create the directory structure that Homebrew expects for a tap:
mkdir -p ~/homebrew-local/Formula
touch ~/homebrew-local/Formula/angel.rb
Open the angel.rb file in your preferred text editor and add the following content:
class Angel < Formula
desc "A description of the Angel application"
homepage "https://github.com/daite/angel"
url "https://github.com/daite/angel/archive/refs/tags/v1.0.0.tar.gz" # Replace with the actual URL
sha256 "SHA256_OF_TARBALL" # Replace with the actual SHA256 checksum
license "MIT"
depends_on "go" => :build
def install
system "go", "build", "-o", bin/"angel", "./cmd/angel"
end
test do
assert_match "angel version", shell_output("#{bin}/angel --version")
end
end
ln -s ~/homebrew-local /opt/homebrew/Library/Taps/homebrew/homebrew-local
brew install angel
If you ever want to remove the tap:
rm -rf /opt/homebrew/Library/Taps/homebrew/homebrew-local