Re: [go-nuts] Tool showing all assignemnts to the blank identifier

2022-11-29 Thread Marcel Huijkman
golangci-lint has :
dogsled:
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 0

On Monday, November 28, 2022 at 1:50:21 PM UTC+1 Jan Mercl wrote:

> On Mon, Nov 28, 2022 at 1:44 PM Wojciech Muła  wrote:
>
> > Is there any tool that would point out places with
> > an assignment to the blank identifier?
> >
> > I'd like to spot possible refactoring/debug leftovers,
> > like `_ := func() {}` or unused imports.
> >
> > I went through the staticcheck list of checks, but
> > didn't find anything similar.
>
> $ grep -n '\b_\b :\?= ' *.go
>

-- 
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/a52cf7be-7e10-4024-a24a-ad2969fce086n%40googlegroups.com.


Re: [go-nuts] Underscore symbol

2022-11-05 Thread Marcel Huijkman
When I explain it during my training I always say it is a trashcan 
variable, anything you put in is to be ignored on the spot.

On Friday, November 4, 2022 at 10:10:20 PM UTC+1 Konstantin Khomoutov wrote:

> On Fri, Nov 04, 2022 at 04:58:35AM -0700, Canuto wrote:
>
> > I'm just starting out with go ...
> > I have searched for lights on this string but without success.
> > What does this sign mean " _, err " , what the underscore symbol means 
> here? 
>
> If you're starting with Go, please start with the Go Tour [1].
> For instance, the use of this underscore sign is covered in [2].
>
> 1. https://go.dev/tour/
> 2. https://go.dev/tour/moretypes/17
>
>

-- 
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/6c745c54-b212-4bb6-8e40-00273e6ee2fan%40googlegroups.com.


Re: [go-nuts] godoc and generic code

2022-11-04 Thread Marcel Huijkman
Perhaps update godoc:
go install golang.org/x/tools/cmd/godoc@latest

On Friday, November 4, 2022 at 7:18:28 AM UTC+1 tapi...@gmail.com wrote:

> You may also try Golds: https://github.com/go101/golds.
> Still not perfect in handling custom generic things,
> but it is generally usable.
>
> On Friday, November 4, 2022 at 1:26:26 AM UTC+8 Hotei wrote:
>
>> Thanks for the very helpful replies. < go doc -all pkg > should meets my 
>> needs for printed documentation.  I guess I will have to weigh the 
>> convenience of navigating which the godoc html version provides vs the 
>> inconvenience of "instantiating" the methods required by the types [T] I 
>> use in this project.  The pkgsite option doesn't seem workable in my case 
>> for the reasons eloquently described by one of the posters to issue 49212.  
>> At any rate, problem solved and thanks again to the golang-nuts group for 
>> the assistance!
>>
>> On Thursday, November 3, 2022 at 9:32:09 AM UTC-4 Sebastien Binet wrote:
>>
>>> On Thu Nov 3, 2022 at 14:02 CET, Jan Mercl wrote: 
>>> > On Thu, Nov 3, 2022 at 12:49 PM Hotei  wrote: 
>>> > 
>>> > > I added some generic code to a project and godoc doesn't seem to 
>>> like that and stops working when it sees the generics. It's a 4 year old 
>>> version of godoc so that's perhaps not a surprise. What is a surprise is 
>>> that godoc isn't shipped with go any longer. Is there a version that 
>>> handles generics and if so where can I find it? A quick search of github 
>>> came up empty but I know things have been moved around so some hints would 
>>> be much appreciated. 
>>> > 
>>> > I'm not in favor of the fact, but It's been deprecated a year ago: 
>>> > https://github.com/golang/go/issues/49212 
>>>
>>> one can use godocs.io for a maintained "godoc-like" binary: 
>>>
>>> - https://godocs.io/go-hep.org/x/hep/sliceop 
>>> - https://sr.ht/~sircmpwn/godocs.io/ 
>>>
>>> (otherwise, 'go doc' does support "generics") 
>>>
>>> hth, 
>>> -s 
>>>
>>

-- 
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/d407dd97-993f-4511-a373-802c55e4fc70n%40googlegroups.com.


[go-nuts] Re: go:embed question

2022-10-13 Thread Marcel Huijkman
I find this question a bit hard to understand. I think it has to do with go 
run and then a URL, which can't be done.
Can you rephrase it?

On Wednesday, October 12, 2022 at 9:37:17 AM UTC+2 esi...@gmail.com wrote:

> I know that //go:embed directive reads the content of the embedable file 
> at compile time. Now if that's the case I wondering if you are running a Go 
> executable with "go run" at the same time while you are downloading like go 
> run github.com/user/projectname@latest (which should embed an external 
> file) why the file is not embedded?
>
> Normally if the file you want to embed does not exits, the compiler will 
> throw you an error telling that "no matching files found". Why is not the 
> case when you are running without a prior download? 
>
> I'm asking this because if I'm running the application normally the file 
> is getting embedded correctly, but if I'm trying to build it on-the-fly 
> with go run this is not happening? 
>

-- 
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/760b8eb4-2644-4be0-a4f8-fb1288e3492en%40googlegroups.com.


Re: [go-nuts] Zero-sized data type

2022-10-13 Thread Marcel Huijkman
What is the usage of that zero-sized data type? Can you give an example 
where that Inner field has any usage?

On Wednesday, October 12, 2022 at 7:27:14 PM UTC+2 
axel.wa...@googlemail.com wrote:

> You can re-order the fields to get the desired effect:
> https://go.dev/play/p/E1KTqVp0i-v
>
> On Wed, Oct 12, 2022 at 6:01 PM Richiise Nugraha  
> wrote:
>
>> Hi, I am looking for zero-sized data type, something like Flexible Array 
>> Member.
>> The size of `struct {}` is indeed zero, but for what reason when it's 
>> inside a struct with another member say (
>> https://go.dev/play/p/DpydJIke7dS):
>>
>> type C struct {
>> Pre   uint64
>> Inner struct{}
>> }
>>
>> That struct sized for 16, while the sum of all member sizes is only 8, 
>> it's like there's hidden padding/align.
>>
>> Thanks!
>> Nugraha
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/2f7254a8-379a-4dc2-bf10-70ee7a209af2n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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/a7883ea8-4850-4cc8-831d-571a088fccf1n%40googlegroups.com.