Created
April 12, 2025 17:55
-
-
Save adibhanna/50d3f541a26706439fb869f7972f8157 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function go_modernize_fzf() { | |
local go_files=$(find . -name "*.go" -not -path "*/vendor/*" | sort) | |
if [[ -z "$go_files" ]]; then | |
echo "No Go files found" | |
return 1 | |
fi | |
local selected_files=$(echo "$go_files" | fzf --multi --height 40% --reverse --preview "cat {}") | |
if [[ -z "$selected_files" ]]; then | |
return 0 | |
fi | |
echo "Running modernize on selected files..." | |
echo "$selected_files" | xargs go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix | |
} | |
go_modernize_fzf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment