elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.67k stars 300 forks source link

Eliminate `// +build` comments when Go 0.18.0 is released #1420

Closed krader1961 closed 2 years ago

krader1961 commented 3 years ago

This is meant as a reminder that lines like this in the source should be removed when Go 0.18.0 is released:

// +build !windows,!plan9

The above should be converted to the now preferred form introduced by Go 0.17.0 if that hasn't already been done:

//go:build !windows && !plan9

See https://golang.org/doc/go1.16#go/build/constraint for more context. I noticed this wasn't already an open issue when looking at the files in pkg/shell/. The redundant build tags confused me for a moment until I remembered that the //go:build syntax is extremely new.

P.S., I was looking at those files because I was trying to understand why my interactive Elvish shell on Windows 10 wasn't sourcing my rc.elv script that I had rsync'd from my primary UNIX system. Specifically, from my "home dir" on MacOS to my "home dir" on my Windows 10 VM. I see that this difference in behavior is documented but it probably needs more documentation since I had no idea it would be using this path (from an embedded fmt.Printf in pkg/shell/paths_windows.go):

 "C:\\Users\\krade\\AppData\\Roaming\\elvish\\rc.elv"

I expected a path like ~/.config/elvish/rc.elv (which does exist by virtue of my rsync command). I am an infrequent MS Windows user so I have no idea what is the optimal Elvish behavior in this context. Would some support for traditional UNIX path resolution on Windows cause problems?

xiaq commented 2 years ago

I'm closing this because it's not necessary to be reminded of this; the legacy constraints will be removed by go fix when Elvish requires Go 1.18 (https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md#transition).