This project contains a tool to pickup a piece of code from a formatted go project.
It is designed to used in code_runner to run some selected code or run a function in a go project.
It can run code almost like the code in real project run. Except it ignored init function in package, and it ignored global variables, the two are useally not think as good design.
linux, maybe macos, but not tested.
rg sed awk gopls, this tools are very common tools in linux platform
- now it is not suppose project path contains space.
- the generate code maybe not a valid main.go, it may contains some unused import and same import. It need the code_runner to run goimports main.go to fix it then it will be valid.
- clone project
cd gopickimports && go build . && mv gopickimports /usr/bin/
- then you can run pickup.sh as common shell script or shebang now
pickup.sh -f $filename -m $methoedname [-s startline] [-e endline]
then see the output.