20240330-tanuki-mingo
workshopないで、やること
OSSを触って、詰まることがあるはず、なのでREADMEに対するフィードバックを行う。
検索した内容等、行った手順を全部書き残す
何かやる前に予想を書いて、その結果をかく
15:15まで作業
作業ログ
まずどのように対象のOSSを決めるか?
luccaさんはgo con miniの発表で気になったのがきっかけでsyncroに興味を持ったのだそう
であれば自分もgo関連のconnpassを漁ってイベント資料を確認すれば興味あるのが出てくるのではないか?
また現時点で気になっているのは、mingo
一旦、mingoについて調べる
golangをminifyするものという認識があるのでminify golangでgoogle検索する
こっちが先にヒットした
二番目の記事がそれっぽい
記事の中にリポジトリのURLがあった
もうこれでいいのでは?
zennの記事のこれを作った理由がおもしろかったから
"「たとえ意味がなくとも、 minify されたい」" 笑
対象決めた
ライセンス: MIT license
理由: 意味がないが、minifyされてもいいじゃない!笑
実際触っていく
とりあえず、READMEの通りにやってみる
正直zennの説明が分かりやすく、そもそもこのリポジトリの存在意義とかが変わりずらいのでは?という気がしていて、その部分(ある意味ギャグ)な部分をREADMEに記載したほうが良いのではないか?笑
homebrewでinstall
早速エラーがでた
code:sh
% brew install koki-develop/tap/mingo
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew).
Installing from the API is now the default behaviour!
You can save space and time by running:
brew untap homebrew/core
brew untap homebrew/cask
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/services, homebrew/core and homebrew/cask).
==> New Formulae
dissent
==> New Casks
lookaway loungy
You have 22 outdated formulae installed.
==> Tapping koki-develop/tap
Cloning into '/opt/homebrew/Library/Taps/koki-develop/homebrew-tap'...
remote: Enumerating objects: 431, done.
remote: Counting objects: 100% (279/279), done.
remote: Compressing objects: 100% (184/184), done.
remote: Total 431 (delta 179), reused 149 (delta 95), pack-reused 152
Receiving objects: 100% (431/431), 72.69 KiB | 966.00 KiB/s, done.
Resolving deltas: 100% (252/252), done.
Tapped 17 formulae (28 files, 112.8KB).
==> Fetching koki-develop/tap/mingo
######################################################################################################################################################################### 100.0%
==> Installing mingo from koki-develop/tap
Error: Your Xcode (14.3.1) at /Applications/Xcode.app is too outdated.
Please update to Xcode 15.1 (or delete it).
Xcode can be updated from the App Store.
Xcodeのバージョンが足りなそう
これはmingoがバージョンを必要としているのか、brewが必要としているのかよくわからない
一旦GPTにきいた
mingoがXcode 15.1以上を必要としていそう
では、Xcodeをupdateする
クソ長い
Xcodeの依存があることを記載したほうが良いよね
どんなふうに書くのが正解なのかな?
GPTに聞いてみる
code:md
Dependencies
System Dependencies
Xcode: This application requires Xcode version 15.1 or higher due to specific features or functionalities utilized in the project. Please ensure your Xcode is updated to meet this requirement.
Checking Your Xcode Version
You can check your current Xcode version by opening Xcode and navigating to Xcode > About Xcode from the menu bar. If your version is below 15.1, please update Xcode via the App Store or the Apple Developer website.
Updating Xcode
To update Xcode to the required version, follow these steps:
Open the App Store on your Mac.
Search for Xcode in the App Store.
Click on the 'Update' button next to Xcode if an update is available. If you don't see an 'Update' button, you might need to download Xcode from the Apple Developer website.
Please note that updating Xcode can take some time depending on your internet connection and the size of the update.
必要なものと手順を記載している
手順まではいいのでは?という気がする
普通に必要なバージョンのみの記載の方がスッキリしそう
code:md
Dependencies
System Dependencies
Xcode: Version 15.1 or higher is required to run this application due to the utilization of specific features or functionalities. Please ensure that your Xcode is updated to meet this requirement.
アップデートできたので、READMEの通り順番にやっていく
code:sh
$ brew install koki-develop/tap/mingo
Error: You have not agreed to the Xcode license. Please resolve this by running:
sudo xcodebuild -license accept
実行
code:sh
$ sudo xcodebuild -license accept
実行
code:sh
go install github.com/koki-develop/mingo@latest
go: downloading github.com/koki-develop/mingo v0.2.2
go: downloading github.com/spf13/cobra v1.8.0
go: downloading github.com/spf13/pflag v1.0.5
実行
code:sh
$ go mod init mingo_survey
$ touch main.go
main.goにREADMEに記載に以下をコピペ
code:go
// main.go
package main
import "fmt"
func fib(n int) int {
if n <= 1 {
return n
}
return fib(n-1) + fib(n-2)
}
func main() {
n := 10
for i := 0; i < n; i++ {
fmt.Println(fib(i))
}
}
実行
code:sh
$ mingo main.go
package main;import "fmt";func fib(n int)int{if n<=1{return n};return fib(n-1)+fib(n-2)};func main(){n:=10;for i:=0;i<n;i++{fmt.Println(fib(i))}};
minifyされた!
-oみたいなオプションあるのかな?
code: sh
$ mingo -h
Go language also wants to be minified.
Usage:
Flags:
-h, --help help for mingo
-v, --version version for mingo
-w, --write write result to (source) file instead of stdout
-wがそうっぽい
実行
code:sh
$ mingo main.go -w
なんかmain.goが直接minifyされた形に編集されてしまった・・・・。
直感と挙動が違う
名前指定はできるのか?
実行
code:sh
$ mingo main.go -w minified_main.go
main.go
Error: lstat minified_main.go: no such file or directory
Usage:
Flags:
-h, --help help for mingo
-v, --version version for mingo
-w, --write write result to (source) file instead of stdout
なんかfileがないって怒ってる
自動では作ってくれないのか?
そんでmain.goが編集されているな
実行
code:sh
$ mingo main.go -w minified_main.go
main.go
minified_main.go
-wは単にフラグで羅列したファイルが全てminifyされて上書きされる挙動を取ることがわかった
-oのissueつくりたいね
minifyされるとどうなるのか確認
before/after
code:sh
-rw-r--r-- 1 XXXXX staff 183 3 30 15:17 main.go
code:sh
-rw-r--r-- 1 XXXXX staff 146 3 30 15:26 main.go
ちゃんとminifyされてる!!
buildしたら一緒になると思うけども・・・。
報告方法を調べる必要があるらしい
プロジェクトによって報告方法が異なるからIssueを運用していないこともある
mingoに関しては特に記載はなさそうなのでIssueを作ることにする
Issueを作っていく
どんなこと書けばいいかわからん!
なんか他のOSSのIssueをみたらわかるかも?
なぜこれが必要か?
何が嬉しいか?
READMEを編集するのならIssueより、直接PRの方が良さそう
PR作成!!