Thanks for sharing your package.

To me it seems that the functions are rather shallow wrappers around other 
single functions from the standard library (e.g., sc.P() maps 1:1 to 
fmt.Printf()). You certainly save a couple of keystrokes while *writing* a 
script this way, but on the other hand, *reading* the resulting code adds 
cognitive overhead, as you need to go one extra step from recognizing 
stdlib functions (fmt.Printf) to recognizing custom lib functions and their 
mapping to the underlying stdlib functions ("ok, there is a sc.P() in this 
script, this maps to fmt.Prinft()..."). 

This is super ok if you write throwaway scripts for your own purpose, but 
once you pass the scripts around, the receivers would have to learn a new 
pacakge API and read through an extra API layer to see what the script is 
doing. Remember that code is much more often read than written.

If the main purpose is to eliminate explicit error handling (which is 
*perfectly 
fine for simple scripts* IMHO), then I would at least prefer longer names, 
like sc.Printf(), which would make the purpose of this function obvious.

Just my $0.02. Otherwise, I generally like the idea of providing a 
simplified API for supporting quick&dirty throwaway scripting in Go. 
Remember what Kelsey Hightower said: "Bash is the reason people leave IT"! 
:-)
On Monday, January 24, 2022 at 12:32:48 PM UTC+1 eko...@gmail.com wrote:

> sc is a convenience package to support writing short automation scripts 
> that simply panic on errors. It is similar to shell scripting with "set -e" 
> option.
>
> https://pkg.go.dev/github.com/egonk/sc
>
> I wrote the package to stop copy pasting trivial helpers in throwaway and 
> build automation scripts. Obviously panics instead of errors are not 
> recommended for Go code, but I saw no big benefits by writing elaborate 
> error messages in such scripts.
>
> M (generic Must) does not show on pkg.go.dev, probably because generics 
> are not yet enabled. P (Printf) and PE (Fprintf os.Stderr) are currently 
> not detected by go vet as printf funcs, is there a way to mark them in the 
> package as printf?
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b14e720a-0dbc-4075-8887-7c190bebdb6cn%40googlegroups.com.

Reply via email to