[go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread Robert Solomon
channels are not queues, as Justin said

On Saturday, April 20, 2024 at 8:18:18 PM UTC-4 Justin Israel wrote:

> On Sunday, April 21, 2024 at 11:18:24 AM UTC+12 Taňryberdi Şyhmyradow 
> wrote:
>
> Hello guys,
> For the following lines, I wanted to print numbers in ordered, but 
> couldn't. Could you please help me and explain the reason
> Thanks in advance
>
> ```
> numbers := []int{1, 2, 3, 4, 5}
>
> // Create a buffered channel to handle multiple values
> printed := make(chan int, len(numbers))
>
> for _, n := range numbers {
> fmt.Println("Sending", n, "to the channel")
> go func() {
> printed <- n
> }() // Pass the value of n by copying it
> }
>
> // Receive all values from the channel in a loop
> for i := 0; i < len(numbers); i++ {
> fmt.Println(<-printed)
> }
> ```
>
>
> When you start a bunch of goroutines in a loop, there is no guarantee as 
> to what order the scheduler will start each one. 
> Thus you will see them delivered in different orders on each run. You have 
> to decide on some form of synchronization. Maybe you choose to run a single 
> goroutine worker that will loop over the source slice, and push the values 
> into the channel in order. Or maybe you will keep using many goroutines but 
> collect them all in the receiver, sort them after the last value is 
> received, and then print them out. Or, maybe your receiver will have some 
> kind of buffering where it collects values and only prints them when it has 
> the next one in sequence. 
>
>
>
> -- 
> Tanryberdi Shyhmyradov
>
>

-- 
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/2b4dcdb7-28fc-46e1-90c2-7c01aeac1e44n%40googlegroups.com.


[go-nuts] Re: new in golang

2024-04-14 Thread Robert Solomon
I'm a hobby programming that's been using Go for a few years.  I'm willing 
to help; others here will likely also answer questions for you

On Sunday, April 14, 2024 at 1:47:32 PM UTC-4 leonardo lima peixoto wrote:

> Oh nice, I'm a beginner and I want to learning golang as well.
>
> Em sábado, 13 de abril de 2024 às 21:42:39 UTC-3, mokwa moffat escreveu:
>
>> I would like to have partner for learning golang. Am a beginner thank You
>>
>

-- 
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/f3fc3fac-b0f2-4885-99c2-2f900eb7d6e5n%40googlegroups.com.


[go-nuts] Re: new in golang

2024-04-14 Thread Robert Solomon
I'm not clear on what you're asking.  I'm a hobby programmer, and I've been 
using Go for a few years for my own purposes.

On Sunday, April 14, 2024 at 1:47:32 PM UTC-4 leonardo lima peixoto wrote:

> Oh nice, I'm a beginner and I want to learning golang as well.
>
> Em sábado, 13 de abril de 2024 às 21:42:39 UTC-3, mokwa moffat escreveu:
>
>> I would like to have partner for learning golang. Am a beginner thank You
>>
>

-- 
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/2a2cf88e-dbe1-4198-8a28-feeac489d888n%40googlegroups.com.


Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Robert Solomon
Showing the call stack is a core function of the Delve debugger for Go.  
See github.com/go-delve/delve/cmd/dlv.  Install w/
  go install github.com/go-delve/delve/cmd/dlv@latest

Once learning how to use delve, then any IDE/editor will work.  I believe 
that both VSCode and Goland use delve's code for their debugging 
capabilities


On Saturday, August 26, 2023 at 6:09:44 PM UTC-4 Robert Engels wrote:

> Sorry that was snotty. Bring back the punch cards to really prove who’s a 
> great developer!
>
> On Aug 26, 2023, at 4:29 PM, Robert Engels  wrote:
>
> 
>
> Or you click on the top stack line in an IDE and then arose down. 
>
> It’s like some people want to go back to horse and buggy “because it was 
> better for the environment”. Balancing competing priorities is a great 
> skill to have. 
>
> On Aug 26, 2023, at 3:51 PM, Justin Israel  wrote:
>
> 
>
>
> On Sun, Aug 27, 2023 at 12:47 AM Mike Schinkel  
> wrote:
>
>> If I understand what you are asking then JetBrains GoLand does. 
>>
>> I do not know if there is a way to use the keyboard, but it does provides 
>> links you can click when it displays the call stack on panic.
>>
>
> If your keymap configuration derives from one of the system configs 
> (Windows, Macos, ...) then "Next Frame" and "Previous Frame" have default 
> mapped hotkeys. So you can do the same workflow Jason mentioned, starting a 
> debugger execution, which panics, and then navigating the stack all via 
> keyboard (if that really is your thing).
>  
>
>>
>> -Mike
>>
>> On Saturday, August 26, 2023 at 8:33:08 AM UTC-4 Jason E. Aten wrote:
>>
>>> Is there any IDE that allows you to jump through a stack trace like 
>>> emacs does?
>>>
>>> e.g. If I have a panic on a run, with two keystrokes I can jump to the 
>>> origin
>>> of the panic, and then their caller, and then the parent caller, and 
>>> then up to
>>> the grandparent on the call stack... instantly. I've never found this 
>>> essential
>>> functionality elsewhere, but maybe I'm just not familiar... A friend of 
>>> mine tried
>>> to add it to Visual Studio and gave up... it was just too hard for VS. 
>>> But maybe JetBrains has it??
>>>
>>> I'd love to try an IDE other than emacs, but this is a fundament thing, 
>>> that I cannot give up.
>>>
>>> On Friday, August 25, 2023 at 6:21:35 PM UTC+1 Mike Schinkel wrote:
>>>
 Yes, as Luke Crook mentioned I think those requirements are more ALM 
 functionality than IDE functionality.  

 Generally, ALM addresses concerns broader than individual concerns 
 whereas IDEs are more focused on individual productivity.

 Just my opinion, but I would expect you'd be better off finding an ALM 
 solution and then an IDE that integrates with that ALM, or vice versa, 
 i.e. 
 find an IDE that integrates with an ALM and then use that ALM.

 #fwiw

 -Mike
 On Wednesday, August 23, 2023 at 7:21:46 AM UTC-4 alex-coder wrote:

> Hi All !
>
> Considering that IBM's punch cards were bearing at least twice, I 
> would vote for them. :-)
>
> Of cource I do agree with them who wrote that to feel comfortable 
> "under fingers" is great !
>
> So, the tasks to code - they are different. 
> Sometimes it is possible to keep all the details regards to the task 
> in a head or several.
> Sometimes it is nesessary to write say a hard copy of them(details) on 
> a paper with a different size.
>
> But in case the task from the area of the "poorly formalized". You 
> spend paper quickly. :-)
>
> The Luke Crook points to:
> https://en.wikipedia.org/wiki/Application_lifecycle_management
>
> I will simplify the task somewhat and take from ALM for example even 
> less than SDLC, namely:
> requirements, design, implementation, testing, deployment.
>
> 1. Requirements must be described somewhere.
> 2. Design artifacts should reflect requirements.
> 3. Design decisions refer to objects and messages that
> implemented in the form of classes and operations.
> 4. Each operation must pass at least one test.
> All tests must be passed successfully.
> 5. The application is assembled and installed there and 
> the tests are successfully passed again.
>
> Question: is there any IDE or plugin which one support that kind of 
> dependencies in a graphical mode ?
>
> Thank you.
>
> вторник, 22 августа 2023 г. в 18:22:52 UTC+3, Mike Schinkel: 
>
>> On Saturday, August 19, 2023 at 5:27:34 AM UTC-4 alex-coder wrote:
>>
>> What I'm looking for is the ability to manage dependencies not only 
>> in code,
>> but entirely in a project from requirements to deployment.
>>
>>
>> I assume you mean a lot more than just Go package dependencies, as 
>> `go mod` handles those nicely.
>>
>> Can you elaborate on the specific dependencies you are trying to 
>> manage?  In 

Re: [go-nuts] memory safe languages question

2023-07-24 Thread Robert Solomon
I'm also old enough to remember that.
I was hoping language experts may have some useful information.
I take ur point.
Thx for answering

On Sun, Jul 23, 2023, 10:10 PM Kurtis Rader  wrote:

> Wouldn't a forum dedicated to Ada be more appropriate for your question?
> I'm old enough to remember reading articles about Ada when it was being
> designed. But that doesn't mean I'm qualified to opine on it as a language
> and there are unlikely to be many people on this mailing list who are
> qualified.
>
> On Sun, Jul 23, 2023 at 5:23 PM Robert Solomon  wrote:
>
>> I've been reading that the NSA wrote a position paper last year about
>> memory safe languages, which include C#, Go, Java, Ruby, Rust and Swift.
>>
>> It's clear to me why C and C++ are not on that list.
>>
>> I always thought that Ada sought to be memory safe, or is equivalent to
>> that by saying that Ada focuses on proving programs to be correct.
>> Why isn't Ada considered memory safe, at least in the eyes of the NSA?
>>
>> --
>> 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/bba0b21e-5e34-4529-9878-5453e099a053n%40googlegroups.com
>> <https://groups.google.com/d/msgid/golang-nuts/bba0b21e-5e34-4529-9878-5453e099a053n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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/CAJTu_tb7CmWeFcfzh46kO-EGFcbgz8N-xeNXipuWE01BFT8CgA%40mail.gmail.com.


[go-nuts] memory safe languages question

2023-07-23 Thread Robert Solomon
I've been reading that the NSA wrote a position paper last year about 
memory safe languages, which include C#, Go, Java, Ruby, Rust and Swift.

It's clear to me why C and C++ are not on that list.

I always thought that Ada sought to be memory safe, or is equivalent to 
that by saying that Ada focuses on proving programs to be correct.
Why isn't Ada considered memory safe, at least in the eyes of the NSA?

-- 
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/bba0b21e-5e34-4529-9878-5453e099a053n%40googlegroups.com.


[go-nuts] Re: how do I use go test for code that needs a flag defined in flag package

2023-05-06 Thread Robert Solomon
thank you

On Saturday, May 6, 2023 at 4:32:57 PM UTC-4 Jason Phillips wrote:

> The testing package documentation mentions this case explicitly:
> https://pkg.go.dev/testing#hdr-Main
>
> In short, you can define a main function (called TestMain) for your test 
> package and call flag.Parse from there.
>
> On Saturday, May 6, 2023 at 4:03:59 PM UTC-4 Robert Solomon wrote:
>
>> A related issue:
>> Now that I can run go test and it's running, how do I define the flag.  
>> Currently, I define it in main(), and also the flag.Parse() is in main().
>> But main() is not run in go test, so I tried putting flag.BoolVar() and 
>> flag.Parse() in an init() function, but that doesn''t work either.
>>
>> How do I test the operations of the flag package when running go test?
>>
>>
>>
>> On Saturday, May 6, 2023 at 3:45:10 PM UTC-4 Robert Solomon wrote:
>>
>>> Looks like I didn't copy everything I have to the playground.  But I do 
>>> have the correct imports and the top statement, package main.
>>>
>>> Thank you for answering, that's working.
>>>
>>> --rob solomon
>>>
>>>
>>> On Saturday, May 6, 2023 at 11:24:11 AM UTC-4 Brian Candler wrote:
>>>
>>>> Your code is incomplete (it's missing all the imports), and "go test" 
>>>> doesn't run your main() function anyway, so it's not going to parse the 
>>>> flags.
>>>>
>>>> But otherwise I think it would be something like this: (single dash, 
>>>> -args not --args)
>>>>
>>>> go test . -v -args - -dots
>>>>
>>>> https://go.dev/play/p/HFJBO1j54iE
>>>>
>>>> On Saturday, 6 May 2023 at 14:02:35 UTC+1 Robert Solomon wrote:
>>>>
>>>>>
>>>>> I have a routine that I want to test, that I have to pass a flag into 
>>>>> this test.  This is on Win10 using Go 1.20.4.  This code is here:
>>>>> https://go.dev/play/p/p-YeGDk1KaM
>>>>>
>>>>> I want to pass a flag I call dots into the test code for this 
>>>>> function.  I tried from within the correct directory
>>>>>
>>>>> go test --args -dots
>>>>> or
>>>>> go test . --args -dots
>>>>>
>>>>> Or from the top of my source tree where the go.mod file is :
>>>>>
>>>>> go test .\detox --args -dots
>>>>> go test .\detox\... --args -dots
>>>>>
>>>>> I get an error message saying:
>>>>>
>>>>> flag provided but not defined: -dots.  
>>>>>
>>>>> But that flag does show up when I run the program using the -h flag, 
>>>>> and it works when not in go test mode.
>>>>> The full pgm is in the link above.
>>>>>
>>>>> What am I missing?
>>>>>
>>>>> --rob solomon
>>>>>
>>>>> PS: a stackoverflow question that's similar to this, from 2014, does 
>>>>> not work for me.
>>>>>
>>>>>

-- 
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/e225a448-88d6-4f31-b19f-69f4f71ef973n%40googlegroups.com.


[go-nuts] Re: how do I use go test for code that needs a flag defined in flag package

2023-05-06 Thread Robert Solomon
A related issue:
Now that I can run go test and it's running, how do I define the flag.  
Currently, I define it in main(), and also the flag.Parse() is in main().
But main() is not run in go test, so I tried putting flag.BoolVar() and 
flag.Parse() in an init() function, but that doesn''t work either.

How do I test the operations of the flag package when running go test?



On Saturday, May 6, 2023 at 3:45:10 PM UTC-4 Robert Solomon wrote:

> Looks like I didn't copy everything I have to the playground.  But I do 
> have the correct imports and the top statement, package main.
>
> Thank you for answering, that's working.
>
> --rob solomon
>
>
> On Saturday, May 6, 2023 at 11:24:11 AM UTC-4 Brian Candler wrote:
>
>> Your code is incomplete (it's missing all the imports), and "go test" 
>> doesn't run your main() function anyway, so it's not going to parse the 
>> flags.
>>
>> But otherwise I think it would be something like this: (single dash, 
>> -args not --args)
>>
>> go test . -v -args - -dots
>>
>> https://go.dev/play/p/HFJBO1j54iE
>>
>> On Saturday, 6 May 2023 at 14:02:35 UTC+1 Robert Solomon wrote:
>>
>>>
>>> I have a routine that I want to test, that I have to pass a flag into 
>>> this test.  This is on Win10 using Go 1.20.4.  This code is here:
>>> https://go.dev/play/p/p-YeGDk1KaM
>>>
>>> I want to pass a flag I call dots into the test code for this function.  
>>> I tried from within the correct directory
>>>
>>> go test --args -dots
>>> or
>>> go test . --args -dots
>>>
>>> Or from the top of my source tree where the go.mod file is :
>>>
>>> go test .\detox --args -dots
>>> go test .\detox\... --args -dots
>>>
>>> I get an error message saying:
>>>
>>> flag provided but not defined: -dots.  
>>>
>>> But that flag does show up when I run the program using the -h flag, and 
>>> it works when not in go test mode.
>>> The full pgm is in the link above.
>>>
>>> What am I missing?
>>>
>>> --rob solomon
>>>
>>> PS: a stackoverflow question that's similar to this, from 2014, does not 
>>> work for me.
>>>
>>>

-- 
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/a4058ec5-2559-4763-b104-5b8fbeb00a89n%40googlegroups.com.


[go-nuts] Re: how do I use go test for code that needs a flag defined in flag package

2023-05-06 Thread Robert Solomon
Looks like I didn't copy everything I have to the playground.  But I do 
have the correct imports and the top statement, package main.

Thank you for answering, that's working.

--rob solomon


On Saturday, May 6, 2023 at 11:24:11 AM UTC-4 Brian Candler wrote:

> Your code is incomplete (it's missing all the imports), and "go test" 
> doesn't run your main() function anyway, so it's not going to parse the 
> flags.
>
> But otherwise I think it would be something like this: (single dash, -args 
> not --args)
>
> go test . -v -args - -dots
>
> https://go.dev/play/p/HFJBO1j54iE
>
> On Saturday, 6 May 2023 at 14:02:35 UTC+1 Robert Solomon wrote:
>
>>
>> I have a routine that I want to test, that I have to pass a flag into 
>> this test.  This is on Win10 using Go 1.20.4.  This code is here:
>> https://go.dev/play/p/p-YeGDk1KaM
>>
>> I want to pass a flag I call dots into the test code for this function.  
>> I tried from within the correct directory
>>
>> go test --args -dots
>> or
>> go test . --args -dots
>>
>> Or from the top of my source tree where the go.mod file is :
>>
>> go test .\detox --args -dots
>> go test .\detox\... --args -dots
>>
>> I get an error message saying:
>>
>> flag provided but not defined: -dots.  
>>
>> But that flag does show up when I run the program using the -h flag, and 
>> it works when not in go test mode.
>> The full pgm is in the link above.
>>
>> What am I missing?
>>
>> --rob solomon
>>
>> PS: a stackoverflow question that's similar to this, from 2014, does not 
>> work for me.
>>
>>

-- 
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/11e9156b-3963-40b3-aef7-0d3ad8b497f5n%40googlegroups.com.


[go-nuts] how do I use go test for code that needs a flag defined in flag package

2023-05-06 Thread Robert Solomon

I have a routine that I want to test, that I have to pass a flag into this 
test.  This is on Win10 using Go 1.20.4.  This code is here:
https://go.dev/play/p/p-YeGDk1KaM

I want to pass a flag I call dots into the test code for this function.  I 
tried from within the correct directory

go test --args -dots
or
go test . --args -dots

Or from the top of my source tree where the go.mod file is :

go test .\detox --args -dots
go test .\detox\... --args -dots

I get an error message saying:

flag provided but not defined: -dots.  

But that flag does show up when I run the program using the -h flag, and it 
works when not in go test mode.
The full pgm is in the link above.

What am I missing?

--rob solomon

PS: a stackoverflow question that's similar to this, from 2014, does not 
work for me.

-- 
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/483cf3d8-49c5-4e1a-befa-a199608567adn%40googlegroups.com.


[go-nuts] go-flags

2023-01-15 Thread Robert Solomon
I'm trying to learn how to use the go-flags package from github.
When I do:  go get github.com/jessevdk/go-flags, I'm getting the error 
below, and I don't understand why

go get: module github.com/jessievdk/go-flags: git ls-remote -q origin in 
/home/rob/go/pkg/mod/cache/vcs/911474c21097b0efc171a365eafdb4b5350619450c2b7cd5f2028b0ac187dc9d:
 
exit status 128:
fatal: could not read Username for 'https://github.com': terminal 
prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https 
for additional information.

-- 
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/09a61126-fed3-4d02-81c0-9da75cc23de7n%40googlegroups.com.


Re: [go-nuts] filepath.walk in Go 1.19

2022-10-29 Thread Robert Solomon
I now have this working as I want using filepath/walk.  

But if I try to use a concurrent walk operation, like the one originally 
written by Michael T Jones, I get behavior that seems to treat any return 
of SkipDir as a fatal error and all walking stops.  filepath/walk does not 
do this; it continues to the next target correctly.

I feel I'm missing something.  Am I?

On Friday, October 28, 2022 at 10:06:39 PM UTC-4 Robert Solomon wrote:

> Thank you very much 
>
> On Fri, Oct 28, 2022, 8:15 AM Marvin Renich  wrote:
>
>> * Robert Solomon  [221028 07:36]:
>> > On ubuntu 22.04, I would like the walk function to NOT follow symlinks 
>> to 
>> > other filesystems.  The find command uses the -xdev switch to achieve 
>> this.
>> > 
>> > How can I get walk to behave like the -xdev switch to find?
>>
>> On Linux:
>>
>>  getdevid_linux.go
>>
>> package main
>>
>> import (
>> "io/fs"
>> "syscall"
>> )
>>
>> type DevId uint64
>>
>> // GetDevice returns the Device ID on which the given file resides.
>> func GetDevice(path string, fi fs.FileInfo) DevId {
>> var stat = fi.Sys().(*syscall.Stat_t)
>> return DevId(stat.Dev)
>> }
>>
>> 
>>
>> Then before calling filepath.Walk, filepath.WalkDir (more efficient), or
>> fs.WalkDir, obtain the device ID of the root.  In the call to WalkDir,
>> pass this device ID to your walk function:
>>
>> err = filepath.WalkDir(root, func(path string, d fs.DirEntry, err
>> error) error { return MyWalkFn(devId, path, d, err) })
>>
>> In MyWalkFn, use d to obtain the device ID of the current path, and
>> return fs.SkipDir if the device IDs do not match.
>>
>> ...Marvin
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/golang-nuts/sBHhJydS66w/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/Y1vHqjKVfQqM3gZy%40basil.wdw
>> .
>>
>

-- 
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/114c555c-34c9-49bf-9347-837f890eae2fn%40googlegroups.com.


Re: [go-nuts] filepath.walk in Go 1.19

2022-10-28 Thread Robert Solomon
Thank you very much

On Fri, Oct 28, 2022, 8:15 AM Marvin Renich  wrote:

> * Robert Solomon  [221028 07:36]:
> > On ubuntu 22.04, I would like the walk function to NOT follow symlinks
> to
> > other filesystems.  The find command uses the -xdev switch to achieve
> this.
> >
> > How can I get walk to behave like the -xdev switch to find?
>
> On Linux:
>
>  getdevid_linux.go
>
> package main
>
> import (
> "io/fs"
> "syscall"
> )
>
> type DevId uint64
>
> // GetDevice returns the Device ID on which the given file resides.
> func GetDevice(path string, fi fs.FileInfo) DevId {
> var stat = fi.Sys().(*syscall.Stat_t)
> return DevId(stat.Dev)
> }
>
> 
>
> Then before calling filepath.Walk, filepath.WalkDir (more efficient), or
> fs.WalkDir, obtain the device ID of the root.  In the call to WalkDir,
> pass this device ID to your walk function:
>
> err = filepath.WalkDir(root, func(path string, d fs.DirEntry, err
> error) error { return MyWalkFn(devId, path, d, err) })
>
> In MyWalkFn, use d to obtain the device ID of the current path, and
> return fs.SkipDir if the device IDs do not match.
>
> ...Marvin
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/sBHhJydS66w/unsubscribe.
> To unsubscribe from this group and all its topics, 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/Y1vHqjKVfQqM3gZy%40basil.wdw
> .
>

-- 
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/CAJTu_tYofRrP-5PJ8%2BjJvDV8kBmAACHOU5FnYiKTq%2B0oUpJE%2Bg%40mail.gmail.com.


[go-nuts] filepath.walk in Go 1.19

2022-10-28 Thread Robert Solomon
On ubuntu 22.04, I would like the walk function to NOT follow symlinks to 
other filesystems.  The find command uses the -xdev switch to achieve this.

How can I get walk to behave like the -xdev switch to find?

Thx

-- 
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/37bd2f59-cb47-4104-97e4-d00c06ac1aa6n%40googlegroups.com.


Re: [go-nuts] Struggling w/ use of a waitgroup

2022-10-02 Thread Robert Solomon
I don't know how to change that.  
I had an issue w/ the main routine ending before some of the worker 
routines were done so I saw incomplete results.
How do I tweak my logic so that I don't need a WaitGroup?  

I forgot about my platform specific code.  Here is the rest of that, that 
is in a file to be compiled on windows.

package main

import (
"fmt"
"os"
"path/filepath"
"strings"
) // Glob is case sensitive.  I want case insensitive.

const estimatedNumberOfFiles = 100

func globCommandLineFiles(patterns []string) []string {
matchingNames := make([]string, 0, estimatedNumberOfFiles)
for _, pattern := range patterns {
matches, err := filepath.Glob(pattern) // Glob returns names of all 
files matching the case-sensitive pattern.
if err != nil {
fmt.Fprintln(os.Stderr, " Error from filepath.Glob is", err)
os.Exit(1)
} else if matches != nil { // At least one match
matchingNames = append(matchingNames, matches...)
}
}
return matchingNames
}

func commandLineFiles(patterns []string) []string {
workingDirname, err := os.Getwd()
if err != nil {
fmt.Fprintln(os.Stderr, "from commandlinefiles:", err)
return nil
}
dirEntries, e := os.ReadDir(workingDirname) // became available as of 
Go 1.16
if e != nil {
return nil
}

matchingNames := make([]string, 0, len(dirEntries))

for _, pattern := range patterns { // outer loop to test against 
multiple patterns.
for _, d := range dirEntries { // inner loop to test each pattern 
against the filenames.
if d.IsDir() {
continue // skip a subdirectory name
}
boolean, er := filepath.Match(pattern, 
strings.ToLower(d.Name()))
if er != nil {
fmt.Fprintln(os.Stderr, er)
continue
}
if boolean {
matchingNames = append(matchingNames, d.Name())
}
}
}
return matchingNames
}


On Sunday, October 2, 2022 at 3:20:22 PM UTC-4 harr...@spu.edu wrote:

> I think Matthew is correct about the immediate source of the deadlock - 
> because the defer is placed too late in the body of grepFile(), the 
> deferred decrement of the waitGroup isn't run on an os.Open() error.
>
> I had the same impression as Jan, I think there is a concern here: the 
> condition for closing grepChan could be, when all files have been sent into 
> the channel. Currently, it's when all work is done. The difference is that 
> one pattern is to increment/decrement waitGroup per unit of work, but 
> another one is to increment/decrement just workers. For the latter, the 
> worker decrements when it infers there is no more work to be done, i.e. it 
> reads that grepChan has closed. I think changing the pattern would avoid 
> the deadlock because, then, there's no reason to interact with the 
> waitGroup per file.
>
> On Sunday, October 2, 2022 at 11:59:26 AM UTC-7 Jan Mercl wrote:
>
>> On Sun, Oct 2, 2022 at 8:52 PM rob  wrote: 
>>
>> > When I do that, I get this error: 
>> > 
>> > panic: sync: negative WaitGroup number 
>>
>> I tried to investigate, but the code does not build. 
>>
>> ./main.go:99:11: undefined: globCommandLineFiles 
>> ./main.go:101:11: undefined: commandLineFiles 
>>
>> Can you please make it a self-contained, minimal program that 
>> reproduces the failure? 
>>
>

-- 
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/1208a4ff-64c2-42bb-975d-e83dea933f0an%40googlegroups.com.


[go-nuts] Struggling w/ use of a waitgroup

2022-10-02 Thread Robert Solomon
https://go.dev/play/p/gIVVLsiTqod

I'm trying to understand concurrency, so I modified a small routine I came 
across quite a while ago.  It's a grep command, but since I have its 
source, I am trying to understand its concurrency.
My problem is that when there are more than about 1800 files to be 
processed, the go routines all deadlock.
This code works fine as long as I have fewer than about 1800 files to 
process.
I don't understand why this happens.

Windows 10.
Tried w/ go1.17, go1.18 and go1.19

--Rob Solomon

-- 
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/3799e520-9a98-4117-b407-f6aea24995ccn%40googlegroups.com.


Re: [go-nuts] Using golang variable in bash script Command

2022-09-20 Thread Robert Solomon
I've done this for Linux and windows, as I regularly use both.  But I used 
a different strategy.  I used the os functions to retrieve a slice of 
strings that I can then filter and sort as I desire.  And I use the command 
line to get the target string.

github.com/drrob1/src/dsrt
also in that repo is ds and rex that do this. dsrtr and dsrtre search all 
subdirectories down from the current dir for what you describe.
And I also sort the returned list by time w/ the most recent first.
--rob solomon

On Monday, September 19, 2022 at 12:08:24 PM UTC-4 princ...@gmail.com wrote:

> Thank you for the response.
>
> On Mon, Sep 19, 2022 at 8:26 PM Tamás Gulácsi  wrote:
>
>> No, please, no!
>>
>> Do NOT use bash with string interpolation if possible!
>> Call find directly:
>> *cmd, err := exec.Command("find", ".", "-name", search)*
>> princ...@gmail.com a következőt írta (2022. szeptember 19., hétfő, 
>> 12:04:32 UTC+2):
>>
>>> then we don't need to add these commands 
>>>
>>>
>>>
>>> *scanner := bufio.NewScanner(os.Stdin)fmt.Println("Enter the substring 
>>> name")scanner.Scan()search:=scanner.Text()*
>>>  right???
>>>
>>> we only need to keep this one
>>>  *cmd, err := exec.Command("bash", "-c", fmt.Sprintf("find . -name %s", 
>>> search))*
>>>
>>> On Monday, September 19, 2022 at 3:31:12 PM UTC+5:30 Jan Mercl wrote:
>>>
 On Mon, Sep 19, 2022 at 11:50 AM PK  wrote:

 > search:=scanner.Text()
 > cmd1,err:=exec.Command("bash", "-c", "find . -name '*$search*'")

 Try something like this, not tested:

 cmd, err := exec.Command("bash", "-c", fmt.Sprintf("find . 
 -name %s", search))

 -- 
>> 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/fb987200-6678-443f-a0ab-884b5f77c324n%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/f1ddd106-82e4-4e90-a585-99f62befda3bn%40googlegroups.com.


[go-nuts] Re: find hwnd on win 10

2022-06-27 Thread Robert Solomon
Howard, based on your advice, my basic code now works as I wanted.  I got 
it working without needing xpzed/win32.

Thank you again.
--rob solomon
On Sunday, June 26, 2022 at 3:44:01 PM UTC-4 Howard C. Shaw III wrote:

>
>
> https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow
>
> "The system restricts which processes can set the foreground window. A 
> process can set the foreground window only if one of the following 
> conditions is true:
>
>- The process is the foreground process.
>- The process was started by the foreground process.
>- The process received the last input event.
>- There is no foreground process.
>- The process is being debugged.
>- The foreground process is not a Modern Application or the Start 
>Screen.
>- The foreground is not locked (see LockSetForegroundWindow 
>
> 
>).
>- The foreground lock time-out has expired (see 
>*SPI_GETFOREGROUNDLOCKTIMEOUT* in SystemParametersInfo 
>
> 
>).
>- No menus are active.
>
> An application cannot force a window to the foreground while the user is 
> working with another window. Instead, Windows flashes the taskbar button of 
> the window to notify the user."
>
>
> https://stackoverflow.com/questions/19136365/win32-setforegroundwindow-not-working-all-the-time
>
> This is more of a Windows API question than a Golang question, so you 
> might do better to direct your questions to a Windows forum. The second 
> link above does describe a workaround involving AttachThreadInput. I'm not 
> sure if w32 has that function mapped or not - if not, you can try 
> https://pkg.go.dev/github.com/xpzed/win32
>
> Good luck!
>

-- 
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/bf5e2abb-856b-46f1-8fa0-24c434902f91n%40googlegroups.com.


[go-nuts] Re: find hwnd on win 10

2022-06-26 Thread Robert Solomon
The following code will flash the found window on the task bar, but will 
not show it so I can see it.  I'm looking for something that is similar to 
takecommand by JPSoft, which has an activate command that will make the 
desired window pop up and be active.

package main

import (
   "flag"
   "fmt"
   w32a "github.com/JamesHovious/w32"
   ct "github.com/daviddengcn/go-colortext"
   ctfmt "github.com/daviddengcn/go-colortext/fmt"
   w32 "github.com/gonutz/w32/v2"
   "os"
   "runtime"
   "strings"
   "time"
   // ps "github.com/mitchellh/go-ps"
   //"github.com/lxn/win"  I can't get this to be useful.
   //w32 "github.com/gonutz/w32/v2"  I also can't get this to be useful.
   //w32a "github.com/JamesHovious/w32"
   // ct "github.com/daviddengcn/go-colortext"
   // ctfmt "github.com/daviddengcn/go-colortext/fmt"
)

const lastModified = "June 26, 2022"

const (
   SW_HIDE   = iota // 0 = hide window and activate another one
   SW_ShowNormal// 1 = activates and displays a window.  If window 
is min'd or max'd, restores it to its original size and posn.  App should use 
this when 1st showing window.
   SW_ShowMinimized // 2 = activate the window and display it minimized.
   SW_ShowMaximized // 3 = activate the window and display it maximized.
   SW_ShowNoActivate// 4 = display window in its most recent size and 
position, but window is not activated.
   SW_Show  // 5 = activate window and display it in its 
current size and posn.
   SW_Minimize  // 6 = minimize window and activate the next 
top-level window in the Z-order.
   SW_MinNoActive   // 7 = display the window as a minimized window, 
but don't activate it.
   SW_ShowNA// 8 = display the window in its current size and 
position, but don't activate it.
   SW_Restore   // 9 = activate and display the window, and if min 
or max restore it to its original size and posn.
   SW_ShowDefault   // 10 = sets the show state based on the SW_ value 
specified in the STARTUPINFO struct passed to the CreateProcess fcn by the pgm 
that started the app.
   SW_ForceMinimize // 11 = minimize the window even if the thread that 
started it is not responding.  Should only be used for windows from a different 
thread.
)

var target = "w32" // this is a firefox window that's opened.

type htext struct {
   h w32.HWND
   title string // this is the title of the window as returned by 
w32.GetWindowText
   isWindow  bool
   isEnabled bool
   isVisible bool
   className string
}

func main() {
   fmt.Printf("w32 testing routine.  Last modified %s.  Compiled by %s\n",
  lastModified, runtime.Version())

   flag.Parse()

   // w32 section

   foreground := w32.GetForegroundWindow() // this is the same as 
forgroundWindowH below.
   focus := w32.GetFocus()
   fmt.Printf(" ForegroundWindow()=%v, Getfocus() = %v\n", foreground, focus)

   activeWindowH := w32.GetActiveWindow()// these are of type hwnd. 
 This one is zero.
   consoleWindowH := w32.GetConsoleWindow()  // this one is 69412 from 
both w32 and w32a routines
   desktopWindowH := w32.GetDesktopWindow()  // this one is 65552
   foregroundWindowH := w32.GetForegroundWindow()// this one is 131244
   consoleW32a := w32a.GetConsoleWindow()// this one is same as 
from w32, and is 69412 this run.
   topWindowH := w32.GetTopWindow(foregroundWindowH) // this one is 68854.
   fmt.Printf(" HWND for ... ActiveWindow = %d, ConsoleWindow = %d and %d, 
DesktopWindow = %d, ForegrndWin = %d, prev foregroundwin = %d, topwin=%d\n",
  activeWindowH, consoleWindowH, consoleW32a, desktopWindowH, 
foregroundWindowH, foreground, topWindowH)

   fmt.Printf("\n--\n")

   w32ProcessIDs, ok := w32.EnumAllProcesses()
   fmt.Printf(" EnumAllProcesses returned ok of %t and %d processes.\n\n", ok, 
len(w32ProcessIDs))

   computerName := w32.GetComputerName()
   version := w32.GetVersion() // don't know what this means.
   fmt.Printf(" ComputerName = %v, version = %v\n\n", computerName, version)

   hwndText := make([]htext, 0, 1000) // magic number I expect will be large 
enough.

   enumCallBack := func(hwnd w32.HWND) bool {
  if hwnd == 0 {
 return false
  }

  ht := htext{
 h: hwnd,
 title: strings.ToLower(w32.GetWindowText(hwnd)),
 isWindow:  w32.IsWindow(hwnd),
 isEnabled: w32.IsWindowEnabled(hwnd),
 isVisible: w32.IsWindowVisible(hwnd),
  }
  ht.className, _ = w32.GetClassName(hwnd)
  hwndText = append(hwndText, ht)
  return true
   }
   w32.EnumWindows(enumCallBack)
   ctfmt.Printf(ct.Green, true, " \n Found %d elements in the hwnd text slice. 
\n Now will find the target of %q.\n", len(hwndText), target)

   var ctr int
   var found bool

   for i, ht := range hwndText {
  if ht.title == "" {
 continue // skip the Printf and search
  }

  ctr++

  

[go-nuts] find hwnd on win 10

2022-06-20 Thread Robert Solomon
Hi.  I'm struggling to get this code to return a non-zero hwnd.  I'm 
compiling w/ Go 1.18.3
Any help would be most appreciated.

package main

import (
   "fmt"
   w32a "github.com/JamesHovious/w32"
   w32 "github.com/gonutz/w32/v2"
   "runtime"

const lastModified = "June 20, 2022"

func main() {

fmt.Printf("goclicksimple to use Go to activate a process so can be clicked on 
the screen.  Last modified %s.  Compiled by %s\n",
   lastModified, runtime.Version())

fmt.Printf(" Now to use w32.FindWindow\n")

target := "*firefox*"
hwnd := w32.FindWindow("MDIClient", target)
fmt.Printf(" target=%q, MDIClient hwnd=%d\n", target, hwnd)

hwnd = w32.FindWindow("", target)
fmt.Printf(" target=%q, empty class hwnd=%d\n", target, hwnd)

hwnd = w32.FindWindow("*", target)
fmt.Printf(" target=%q, * hwnd=%d\n", target, hwnd)

hwnd = w32.FindWindow("*lient*", target) // covers Client and client
fmt.Printf(" target=%q, *lient* hwnd=%d\n", target, hwnd)

var classString string
hwnd2 := w32a.FindWindowS(, )
fmt.Printf(" w32a.FindWindowS empty class, target=%q, hwnd2=%v\n", target, 
hwnd2)

classString = "*"
hwnd2 = w32a.FindWindowS(, )
fmt.Printf(" w32a.FindWindowS '*' class, target=%q, hwnd2=%v\n", target, hwnd2)

classString = "*lient*"
hwnd2 = w32a.FindWindowS(, )
fmt.Printf(" w32a.FindWindowS '*lient*' class, target=%q, hwnd2=%v\n", target, 
hwnd2)

classString = "*lass*"
hwnd2 = w32a.FindWindowS(, )
fmt.Printf(" w32a.FindWindowS '*lass*' class, target=%q, hwnd2=%v\n", target, 
hwnd2)
}

-- 
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/7fcdfc94-2bff-4f87-8c3d-461fb67d32c9n%40googlegroups.com.


[go-nuts] Re: Golang and virustotal

2022-05-13 Thread Robert Solomon
My work around is to compile using  -ldflags="-s -w"

This has worked for the cases when my files make Windows unhappy.  I 
reported it as a bug to Microsoft months ago; I see that they got right on 
it.

--rob solomon


On Wednesday, May 11, 2022 at 11:50:20 AM UTC-4 Rusco wrote:

> Regarding: "compile a simple helloworld main ...": 
>
> My workaround is to insert a
>   import "C"
> among the other imports. It somehow alters the structure of the binary 
> created and my av no more recognizes the binary. This is actually something 
> which never happened when I am doing some Rust work.  
>
> Might help.
>
>
> On Friday, 29 April 2022 at 11:22:38 UTC+1 Paolo C. wrote:
>
>> Hello,
>> I noticed that if you download golang portable zip for aMD64 and upload 
>> the
>> go.exe or gofnt.exe to virustotal one av complains.
>> If you compile a simple helloword main and upload, 4 or 5 minor av 
>> complain.
>> Anyone has this issue too?
>> I tested this from many machines, some completely virgin, so it should 
>> not be my environment.
>> Thanks
>> Paolo
>>
>

-- 
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/a5f8bcca-6ee7-4af0-939c-95165bc07844n%40googlegroups.com.


Re: [go-nuts] Threats found on Win 10 21H1 64 bit computer

2021-12-16 Thread Robert Solomon
Since this is Windows Defender, the bug report would have to go to 
Microsoft.  
I've heard that they largely ignore such reports.
So it goes.

Thanks for answering me, though.
--rob solomon

On Wednesday, December 15, 2021 at 9:13:12 PM UTC-5 Ian Lance Taylor wrote:

> On Wed, Dec 15, 2021 at 4:55 PM rob  wrote:
> >
> > I am compiling my own code using Go 1.17.5 (also happens w/ other 
> versions)
> >
> > When I compile this code on my computer running win 10 21H1 64-bit
> > system using "go install", the resulting exe file bothers windows
> > anti-virus a lot. This is what I see
> >
> > Behavior:Win32/Execution.A!ml Severe
> >
> > And Windows deletes the file.
> >
> >
> > I have discovered that if I compile using
> >
> > go install -ldflags="-s -w"
> >
> > Windows does not flag the exe file as dirty and delete it.
> >
> >
> > Some of my code causes this when compiled, but most does not.
> >
> >
> > Why is this happening? I don't think my Win 10 setup is so unusual.
> > This has been happening for months; I saw this behavior also when
> > compiling using earlier versions of Go 1.17, and also Go 1.16
> >
> > I don't remember it happening before Go 1.16
>
>
> See https://go.dev/doc/faq#virus .
>
> Ian
>

-- 
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/7520a65c-c341-43a7-ac5f-3172c7af6b30n%40googlegroups.com.


Re: [go-nuts] cgo error I don't understand

2021-11-04 Thread Robert Solomon
The results of go env are below.  If I'm reading this correctly, CC=gcc.

set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Owner\AppData\Local\go-build
set GOENV=C:\Users\Owner\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Owner\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Owner\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.2
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\Owner\go\src\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments 
-fmessage-length=0 
-fdebug-prefix-map=C:\Users\Owner\AppData\Local\Temp\go-build4162893276=/tmp/go-build
 
-gno-record-gcc-switches


On Thursday, November 4, 2021 at 6:20:10 PM UTC-4 Ian Lance Taylor wrote:

> On Wed, Nov 3, 2021 at 5:40 PM Robert Solomon  wrote:
> >
> > I'm setting up a new Windows10 computer. I installed Go 1.17.2 and 
> mingw64 for cgo. When I tried to compile a project that uses cgo, I got 
> this error:
> >
> > cgo: exec gcc: gcc resolves to executable relative to current directory 
> (.\\msys64\mingw64\bin\gcc.exe)
> >
> > This is a program that compiles fine on my older win10 computer.
> >
> > I don't think this matters, but I'm compiling a program of mine that 
> uses fyne, which uses cgo.
>
> This suggests that the CC environment variable is set to
> ".\\msys64\mingw64\bin\gcc.exe" with a leading dot. That is not an
> absolute path. That is not permitted for the reasons given at
> https://golang.org/issue/43783.
>
> Ian
>

-- 
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/e60e5b03-92d4-4f01-a516-1fca7e2905bdn%40googlegroups.com.


[go-nuts] cgo error I don't understand

2021-11-03 Thread Robert Solomon

I'm setting up a new Windows10 computer.  I installed Go 1.17.2 and mingw64 
for cgo.  When I tried to compile a project that uses cgo, I got this error:

cgo: exec gcc: gcc resolves to executable relative to current directory 
(.\\msys64\mingw64\bin\gcc.exe)

This is a program that compiles fine on my older win10 computer.

I don't think this matters, but I'm compiling a program of mine that uses 
fyne, which uses cgo.

--rob

-- 
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/a0c7cd77-14c3-4eab-b5ca-c8964e2e01fan%40googlegroups.com.


[go-nuts] Re: Best Go paid course

2021-10-30 Thread Robert Solomon

Based on this recommendation, I started Bill's class and got the book. I 
like the class a lot.
Thanks for the post
  
(sorry for my response not originally linking to this thread)
On Saturday, October 23, 2021 at 5:19:30 PM UTC-4 leam...@gmail.com wrote:

> Ahmed,
>
> I would recommend two pairs of resources. First, if you want to build your 
> level of Go above the basic, get "Learning Go" by Jon Bodner, and check out 
> his Safaribooks Online "Go in 3 Hours" video. Once you're solid there, look 
> at William "Bill" Kennedy's "Ultimate Go Course, 2nd edition" on 
> Safaribooks Online. There is an "Ultimate Go notebook" that parallels the 
> course.
>
> Coursera has a specialization on Go, from UCB. That might interest you as 
> well. If you did that, I would put it between Jon's book/course and Bill's. 
> The UCB course is better if you have a decent introduction to the langauge 
> before starting.
>
> Leam
>
> On Sunday, October 10, 2021 at 2:44:11 PM UTC-5 ahme...@gmail.com wrote:
>
>> Hello friends,
>> I'm an engineer with some good background in different programming 
>> languages like dotnet and Spring boot, also I have focused on web (mainly 
>> react) for the past few years, I also have `basic` knowledge in Go.
>>
>> Now i need to take the next level in Go and build some large scale API 
>> application with multiple database backends and 3rd party API integration 
>> (mostly rest). 
>>
>> So i'm thinking to buy a course that gives me the jumpstart, especially 
>> in areas like concurrency and performance optimization, I would appreciate 
>> any recommendation for a paid course and hope that such course already 
>> exists.
>>
>> Best,
>> Ahmed
>>
>

-- 
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/56945190-2d81-4226-9472-bf4f6780c499n%40googlegroups.com.


[go-nuts] http://groups.google.com/group/golang-nuts/t/c097016fb4fd97e?utm_source=digest_medium=email

2021-10-29 Thread Robert Solomon
Based on this recommendation, I started Bill's class and got the book.   I
like the class a lot.
Thanks for the post

On Sat, Oct 23, 2021, 7:23 PM  wrote:

> golang-nuts@googlegroups.com
> 
>  Google
> Groups
> 
> 
> Topic digest
> View all topics
> 
>
>- Best Go paid course <#m_5181747935597135954_group_thread_0> - 1
>Update
>- initialization loop ? <#m_5181747935597135954_group_thread_1> - 1
>Update
>- Help getting database/sql pooling merged
><#m_5181747935597135954_group_thread_2> - 1 Update
>
> Best Go paid course
> 
> Leam Hall : Oct 23 06:05AM -0700
>
> Ahmed,
>
> I would recommend two pairs of resources. First, if you want to build your
> level of Go above the basic, get "Learning Go" by Jon Bodner, and check
> out
> his Safaribooks Online "Go in 3 Hours" video. Once you're solid there,
> look
> at William "Bill" Kennedy's "Ultimate Go Course, 2nd edition" on
> Safaribooks Online. There is an "Ultimate Go notebook" that parallels the
> course.
>
> Coursera has a specialization on Go, from UCB. That might interest you as
> well. If you did that, I would put it between Jon's book/course and
> Bill's.
> The UCB course is better if you have a decent introduction to the langauge
> before starting.
>
> Leam
>
> Back to top <#m_5181747935597135954_digest_top>
> initialization loop ?
> 
> Michael Ellis : Oct 23 09:05AM -0700
>
> > The rules for when an initialization loop occurs are part of the
> language
> spec: https://golang.org/ref/spec#Package_initialization.
>
> Thanks for the link. It helps with questions I've had recently about
> package initialization. Can you confirm that the statement
>
> "If a package has imports, the imported packages are initialized before
> initializing the package itself. If multiple packages import a package,
> the
> imported package will be initialized only once"
>
> means that if
> - package x imports y and z (in that order), and
> - package y imports a
> - package a imports b
> - package z imports b
>
> then b will be initialized during the initialization of y ( and not
> initialized again during the import of z)?
> Back to top <#m_5181747935597135954_digest_top>
> Help getting database/sql pooling merged
> 
> Steven Hartland : Oct 23 12:29AM +0100
>
> There's been a long standing bug <
> https://github.com/golang/go/issues/39471>
> in database/sql pooling which means SetConnMaxIdleTime doesn't work.
>
> I found and fixed the bug <
> https://go-review.googlesource.com/c/go/+/237337>
> back in June of 2020, but have so far been unable to get this relatively
> simple fix across the line.
>
> With 1.18 freeze fast approaching, I'd love to get this merged before then
> so we can have working DB pooling without having to run a patched core
> library.
>
> Others have looked at it in the past and said the fix looks good, and we've
> been running it for well over a year now, so I would say confidence is high
> ;-)
>
> So any help to get it merged would be most appreciated!
>
> Regards
> Steve
> Back to top <#m_5181747935597135954_digest_top>
> You received this digest because you're subscribed to updates for this
> group. You can change your settings on the group membership page
> 
> .
> To unsubscribe from this group and stop receiving emails from it send an
> email to golang-nuts+unsubscr...@googlegroups.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/CAJTu_tb18x-juxx35q-MLGvXjZZ2BdxemYS9VWLmm6_JX1V2Aw%40mail.gmail.com.


[go-nuts] Re: Go 1.17 Beta 1 is released

2021-06-14 Thread Robert Solomon
I read the draft release notes.

Does Go 1.17 intend on supporting GOPATH mode.  I could not find any notes 
on this.


On Thursday, June 10, 2021 at 11:47:16 AM UTC-4 dmit...@golang.org wrote:

> Hello gophers,
>
> We have just released go1.17beta1, a beta version of Go 1.17.
> It is cut from the master branch at the revision tagged go1.17beta1.
>
> Please try your production load tests and unit tests with the new version.
> Your help testing these pre-release versions is invaluable.
>
> Report any problems using the issue tracker:
> https://golang.org/issue/new
>
> If you have Go installed already, the easiest way to try go1.17beta1
> is by using the go command:
> $ go get golang.org/dl/go1.17beta1
> $ go1.17beta1 download
>
> You can download binary and source distributions from the usual place:
> https://golang.org/dl/#go1.17beta1
>
> To find out what has changed in Go 1.17, read the draft release notes:
> https://tip.golang.org/doc/go1.17
>
> Cheers,
> The Go Team
>

-- 
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/a51dd316-9259-476b-b6ff-bd3388358384n%40googlegroups.com.


[go-nuts] Re: Modules... why it has to be so painfull?

2021-04-08 Thread Robert Solomon
I agree w/ your basic premise, that modules are quite painful.  
However, after much trials, tribulations, and posting here, I received the 
solution that allows me to structure my code as before (and like you, all 
in ~/go/src).  I only had to edit the import strings to reflect 
"src/mypackage" instead of "mypackage".
That is, I just had to add "src/" to all of my import statements for my own 
code.  I am able to leave the directory structure as is.
I also had to set GOBIN

Look at the responses I received under the subject "package  is 
not in GOROOT 

"

You are probably frustrated for the same reason as I, ie, the documentation 
for module mode is not written for us dummies.  I went over the docs and 
found them most unhelpful and needlessly complex.  They fall into the 
category of "understood only if previously understood."

Again, read the responses I received to my most recent thread, and you, 
too, will be ready to GO. *:-)*

On Wednesday, April 7, 2021 at 5:31:07 PM UTC-4 Slawomir Pryczek wrote:

> Hey Guys, I'm struggling with the new "modules" approach and after 
> checking several help files it seems it's inconvinient beyond belief. 
> Basically i have an app:
>
> ...src/
> /myapp/main.go package main
> /pool/pool.go package pool
>
> And i can't even include package pool into main without manually 
> initializing module, then installing it, and then when i do any change to 
> pool i'll have to re-get / re-install the package, so it even breaks things 
> as simple as conviniently building a basic app with >1 shared package.
>
> Question is why it's no longer possible to break the project into 
> independent packages and easily re-use them. I have eg. a webserver which 
> implements each operation as separate package, and also it has slab 
> allocator which other projects are using. And it works great.
>
> Maybe someday i'd like to convert the slab allocator into separated 
> module, but why forcing users to do so much unnecessary work and pretend 
> everyone wants to expose everything they're writing as module from earliest 
> stage of the project?
>
> Is there any way to retain this kind of structure without countless hours 
> wasted on manually initializing modules and other completely pointless 
> maintenance tasks. Previously i was just able to create a package in gopath 
> and use it everywhere, refactoring was very easy and i could easily split 
> any project into multiple packages. Actually go was so good because 
> refactoring and reorganizing code was so easy. Now it seems that's no 
> longer possible and in docs I found info that gopath approach will be 
> obsolete, so i'm trying to go with the new one. Which seems so painfull...
>
> Also read several posts about local packages. Complexity of this is beyond 
> ridiculous. Really i need to install a local proxy or use some special 
> directives to allow my appa and appb to use packagec? Really it needs to be 
> so complex and so user unfriendly so instead of writing code we'll be 
> thinking about setting up proxies and configuring dependencies just to 
> share some code between 2 local apps because this has to be done via HTTP 
> or special configuration?
>
> Anyone has an idea for a reasonable solution which will allow easy 
> refactoring and code organization in packages, in this new model?
>
> Thanks,
> Slawomir.
>

-- 
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/e68eede7-5698-4ab2-aa21-805ea6ca8d00n%40googlegroups.com.


[go-nuts] pointer receiver basic question

2020-07-23 Thread Robert Solomon
Hi.  I'm going thru the example code for container/heap.  In the 
documentation is this example:

func (h *IntHeap) Pop() interface{} {
old := *h
n := len(old)
x := old[n-1]
*h = old[0 : n-1]   // my question is about this line.
return x
}

Why does the last assignment have to assign to a dereferenced pointer, ie, 
*h = old[0 : n-1]?
Why does it not work if the last assignment is written as old = old[0 : 
n-1]?  I know this does not work because I tried it.

Thanks for your attention.

-- 
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/e5aeb96b-1d79-4258-ad60-e557f76dbaaeo%40googlegroups.com.


Re: [go-nuts] go 1.13 won't compile

2019-09-30 Thread Robert Solomon
Then my question becomes, what's different about linuxmint 19.2 to require
me to set GO111MODULE=no

On Mon, Sep 30, 2019, 11:06 AM Everton Marques 
wrote:

> Your code from playground compiled fine for me on Debian Linux.
> Tested with Go 1.13 and 1.13.1.
>
> Just had to include the missing func:
>
> func GetUserGroupStr(f os.FileInfo) (string, string) {
> return "foo", "bar"
> }
>
>
>
> Em segunda-feira, 30 de setembro de 2019 11:34:52 UTC-3, Robert Solomon
> escreveu:
>>
>> Your experience matches mine when compiled on windows 10.
>>
>> But linuxmint experience is as I described.   Another responder asked me
>> if it works when I set GO111MODULE=no.
>>
>> It does work when I do that.   I find it interesting that the linux
>> behavior seems to be different
>>
>> On Mon, Sep 30, 2019, 9:17 AM Michael Ellis  wrote:
>>
>>> FWIW, I copied your code from Go Playground into ~/go/src/dsrt/dsrt.go
>>> on my OS X machine.  I replaced an undefined function at line 375 (see
>>> below) with direct assignments for usernameStr and groupNameStr. It
>>> compiled (with go build) and ran without reporting an error under go 1.13.
>>>
>>> // usernameStr, groupnameStr := GetUserGroupStr(f) // util function in
>>> platform specific code, only for linux and windows.  Not needed anymore.
>>> Probably won't compile for foreign computer.
>>> // GetUserGroupStr() is undefined, so hardcode a
>>> couple of nonsense strings to test compilation.
>>> usernameStr := "foo"
>>> groupnameStr := "bar"
>>>
>>>
>>>
>>> On Saturday, September 28, 2019 at 2:55:51 PM UTC-4, rob wrote:
>>>>
>>>> I guess I was not clear enough.  My apologies.  dsrt is my own code.  I
>>>> remember an earlier posting on this list recommended 'go install' instead
>>>> of 'go build'
>>>>
>>>> ~/go/src/dsrt/dsrt.go, util_linux.go, util_windows.go
>>>>
>>>> And I have written other small programs in go that I use for myself. I
>>>> put it in https://play.golang.org/p/U7FgzpqCh-B
>>>>
>>>> It compiles and runs fine on go 1.12.x under linux, and fine on go 1.13
>>>> under windows 10.  I have not yet installed go1.13.1 on my windows 10 box.
>>>>
>>>> I remember a promise that anything that compiles under go 1.0.0 will
>>>> not be broken.  Not being able to compile using go 1.13 that works fine
>>>> using go 1.12.x, broke my code.
>>>>
>>>> I'm not a professional programmer.  I don't know what else to include
>>>> here to demonstrate my problem.
>>>>
>>>> Thanks for your response.
>>>>
>>>> --rob solomon
>>>>
>>>>
>>>>
>>>> On 9/28/19 11:42 AM, Marcin Romaszewicz wrote:
>>>>
>>>> What was the last version of Go which worked for you?
>>>>
>>>> "dsrt" isn't a valid module path in the new module resolution code.
>>>> Does it work if you disable modules - "GO111MODULE=off go install dsrt
>>>> "?
>>>>
>>>>
>>>>
>>>> On Sun, Sep 22, 2019 at 9:56 AM rob  wrote:
>>>>
>>>>> Hi.  I think I'm having an issue compiling my code w/ go 1.13.  I have
>>>>> not had any issues up until now.  I have my code in the default
>>>>> locations off of ~/go/src w/ a directory for each little bit of code I
>>>>> wrote.
>>>>>
>>>>> Running under linuxmint 19.2 amd64, I installed the go binary by first
>>>>> nuking /usr/local/go, and then
>>>>>
>>>>>  sudo tar -C /usr/local -xf go1.13.linux-amd64.tar.gz.
>>>>>
>>>>> When I run go version, I get go version go1.13 linux/amd64
>>>>>
>>>>> Now when I run
>>>>>
>>>>>  go install dsrt
>>>>>
>>>>> I'm getting an error message:
>>>>>
>>>>>  can't load package: package dsrt: mallformed module path "dsrt" :
>>>>> missing dot in first path element.
>>>>>
>>>>> I do not have, need or use a go.mod.  In fact, I don't really
>>>>> understand
>>>>> them.  And I don't yet understand what vendoring means.
>>>>>
>>>>> As an aside, I also compile on a win10 amd64 computer.  I instal

Re: [go-nuts] go 1.13 won't compile

2019-09-30 Thread Robert Solomon
Your experience matches mine when compiled on windows 10.

But linuxmint experience is as I described.   Another responder asked me if
it works when I set GO111MODULE=no.

It does work when I do that.   I find it interesting that the linux
behavior seems to be different

On Mon, Sep 30, 2019, 9:17 AM Michael Ellis 
wrote:

> FWIW, I copied your code from Go Playground into ~/go/src/dsrt/dsrt.go on
> my OS X machine.  I replaced an undefined function at line 375 (see below)
> with direct assignments for usernameStr and groupNameStr. It compiled (with
> go build) and ran without reporting an error under go 1.13.
>
> // usernameStr, groupnameStr := GetUserGroupStr(f) // util function in
> platform specific code, only for linux and windows.  Not needed anymore.
> Probably won't compile for foreign computer.
> // GetUserGroupStr() is undefined, so hardcode a
> couple of nonsense strings to test compilation.
> usernameStr := "foo"
> groupnameStr := "bar"
>
>
>
> On Saturday, September 28, 2019 at 2:55:51 PM UTC-4, rob wrote:
>>
>> I guess I was not clear enough.  My apologies.  dsrt is my own code.  I
>> remember an earlier posting on this list recommended 'go install' instead
>> of 'go build'
>>
>> ~/go/src/dsrt/dsrt.go, util_linux.go, util_windows.go
>>
>> And I have written other small programs in go that I use for myself. I
>> put it in https://play.golang.org/p/U7FgzpqCh-B
>>
>> It compiles and runs fine on go 1.12.x under linux, and fine on go 1.13
>> under windows 10.  I have not yet installed go1.13.1 on my windows 10 box.
>>
>> I remember a promise that anything that compiles under go 1.0.0 will not
>> be broken.  Not being able to compile using go 1.13 that works fine using
>> go 1.12.x, broke my code.
>>
>> I'm not a professional programmer.  I don't know what else to include
>> here to demonstrate my problem.
>>
>> Thanks for your response.
>>
>> --rob solomon
>>
>>
>>
>> On 9/28/19 11:42 AM, Marcin Romaszewicz wrote:
>>
>> What was the last version of Go which worked for you?
>>
>> "dsrt" isn't a valid module path in the new module resolution code. Does
>> it work if you disable modules - "GO111MODULE=off go install dsrt"?
>>
>>
>>
>> On Sun, Sep 22, 2019 at 9:56 AM rob  wrote:
>>
>>> Hi.  I think I'm having an issue compiling my code w/ go 1.13.  I have
>>> not had any issues up until now.  I have my code in the default
>>> locations off of ~/go/src w/ a directory for each little bit of code I
>>> wrote.
>>>
>>> Running under linuxmint 19.2 amd64, I installed the go binary by first
>>> nuking /usr/local/go, and then
>>>
>>>  sudo tar -C /usr/local -xf go1.13.linux-amd64.tar.gz.
>>>
>>> When I run go version, I get go version go1.13 linux/amd64
>>>
>>> Now when I run
>>>
>>>  go install dsrt
>>>
>>> I'm getting an error message:
>>>
>>>  can't load package: package dsrt: mallformed module path "dsrt" :
>>> missing dot in first path element.
>>>
>>> I do not have, need or use a go.mod.  In fact, I don't really understand
>>> them.  And I don't yet understand what vendoring means.
>>>
>>> As an aside, I also compile on a win10 amd64 computer.  I installed
>>> windows binary in the usual way on that computer, compiled my code using
>>> go install, and I've not had any issues there.  I only have an issue
>>> here on linuxmint and go 1.13.
>>>
>>> What's up?
>>>
>>> --rob solomon
>>>
>>>
>>> --
>>> 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 golan...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/golang-nuts/3e9c5dad-2fda-9574-d8f9-8cedfb7986e5%40fastmail.com
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/golang-nuts/5hh--qle2KI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> golan...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LtsWqufQHw%2BmJtAe60KnCHPag9SPVAtjkP2XzkkuHcwyg%40mail.gmail.com
>> 
>> .
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/5hh--qle2KI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/84d7a41b-5fff-428c-9e10-244ae2cc6a0b%40googlegroups.com
> 

Re: [go-nuts] Re: go 1.13 won't compile

2019-09-28 Thread Robert Solomon
I'm getting the sense that my question is below getting an answer I can 
understand and follow.   

Is there a more suitable site for me to post my question without irritating 
people? 

-- 
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/0ea59079-4b23-42a8-b23a-5c51ceffae57%40googlegroups.com.


[go-nuts] Re: go 1.13 won't compile

2019-09-26 Thread Robert Solomon
Should I file an issue 

-- 
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/b341bb68-818c-4f7c-a4c9-8de4910358a9%40googlegroups.com.


[go-nuts] Re: go 1.13 won't compile

2019-09-24 Thread Robert Solomon
Sometimes I hate autocorrect
I mean ~/go/src

-- 
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/c1981f9f-36eb-4ea6-bff5-1b4fa601dc26%40googlegroups.com.


[go-nuts] Re: go 1.13 won't compile

2019-09-23 Thread Robert Solomon
If I understand you,  you want me to not use ~/go/sec?  That confuses me.  Am I 
getting expected behavior? 

-- 
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/f63f63cb-1d45-4971-a245-55a62273d3f2%40googlegroups.com.


[go-nuts] Re: Can you spare a Samsung S5 for the Gio project?

2019-07-30 Thread Robert Solomon
I have one that works.   I'm in nyc area.

-- 
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/8a47616c-8bab-43fd-a894-2ff01e613ebc%40googlegroups.com.


[go-nuts] Need help to launch hello.go

2019-04-30 Thread Robert Solomon
I use win 10.  I have my code as subdirectories in src.  I see that you don't.  
Hello/ is not in src/.

And I then run go install from within src/

I also do this on ubuntu. 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Learning Data Structures and algorithms with Golang

2019-04-14 Thread Robert Solomon
I actually find it useful to have these posted here.  I'm a notice Go 
programmer, and these references help me.
I also saw a reference to "Hands On GUI Application Development in Go," 
which I'm starting to read now.


On Friday, April 5, 2019 at 10:28:52 AM UTC-4, Bhagvan Kommadi wrote:
>
> Check out my published book on Amazon from packt: 
>
>  Learning Data Structures and algorithms with Golang
>
>
> https://www.amazon.in/gp/product/1789618509?ref=em_1p_0_ti_=pe_2516461_197852611
>
>
> #machinelearning #go #fintech #algorithms #datastructures
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: compiling from within vim not working

2018-11-19 Thread Robert Solomon
I'm running gvim when I try this.  I was able to symlink as an earlier poster 
instructed.  
Now I'm having a different problem.   I'm getting the error that no go files 
are found.  My code is in ~/go/src, so each file is dir/code file.go.  gvim 
make is confused by that 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Concurrent and blocking data

2018-04-09 Thread Robert Solomon
I would like to know the answers to 2 and 3

I'm a relatively new gopher

On Mon, Apr 9, 2018, 12:59 PM Robert Solomon <drrob...@gmail.com> wrote:

> I would like to know the answers to 2 and 3
>
> I'm a relatively new gopher
>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Concurrent and blocking data

2018-04-09 Thread Robert Solomon
I would like to know the answers to 2 and 3

I'm a relatively new gopher

>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: Reading os.Stdin, Unbuffered

2017-11-30 Thread Robert Solomon
Thanks

On Nov 28, 2017 8:03 PM, "Robert Solomon" <drrob...@gmail.com> wrote:

I trying to learn how to use pseudo-terminal-go.  It works fine under
Ubuntu 16.04 amd64.  But not fine on win10 64 bit.

go get github.com/carmark/pseudo-terminal-go/terminal

#github.com/carmark/pseudo-terminal-go/terminal
github.com\carmark\pseudo-terminal-go\terminal\terminal.go:715:15:
Undefined State
github.com\carmark\pseudo-terminal-go\terminal\terminal.go:719:2::
Undefined Restore
github.com\carmark\pseudo-terminal-go\terminal\terminal.go:724:18:
Undefined MakeRaw

I tried it with the -u flag also and got the same result.  And it doesn't
matter if I use \ or / on that command line.

I also use github's termbox-go on this win10 box, and that works fine.

What's up?

--rob solomon

On Monday, November 27, 2017 at 9:59:52 AM UTC-5, dc0d wrote:
>
> Is there a way to read from `os.Stdin` in an unbuffered way? (Not waiting
> for a `\n` or anything).
>
-- 
You received this message because you are subscribed to a topic in the
Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/golang-nuts/NvD-pOTASIk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Reading os.Stdin, Unbuffered

2017-11-28 Thread Robert Solomon
I trying to learn how to use pseudo-terminal-go.  It works fine under 
Ubuntu 16.04 amd64.  But not fine on win10 64 bit. 

go get github.com/carmark/pseudo-terminal-go/terminal

#github.com/carmark/pseudo-terminal-go/terminal
github.com\carmark\pseudo-terminal-go\terminal\terminal.go:715:15: 
Undefined State
github.com\carmark\pseudo-terminal-go\terminal\terminal.go:719:2:: 
Undefined Restore
github.com\carmark\pseudo-terminal-go\terminal\terminal.go:724:18: 
Undefined MakeRaw

I tried it with the -u flag also and got the same result.  And it doesn't 
matter if I use \ or / on that command line.

I also use github's termbox-go on this win10 box, and that works fine.

What's up?

--rob solomon

On Monday, November 27, 2017 at 9:59:52 AM UTC-5, dc0d wrote:
>
> Is there a way to read from `os.Stdin` in an unbuffered way? (Not waiting 
> for a `\n` or anything).
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Suggestions for go 2

2017-08-12 Thread Robert Solomon
Is there any one interested in compile time and date like the __time__ and
__date__ macros in c

On Aug 8, 2017 7:26 PM,  wrote:

golang-nuts@googlegroups.com

Google
Groups


Topic digest
View all topics


   - A humble request/challenge <#m_395805729739486593_group_thread_0> - 4
   Updates
   - [ANN] Edit - Acme command language
   <#m_395805729739486593_group_thread_1> - 5 Updates
   - Getting Uid/Gid for a folder <#m_395805729739486593_group_thread_2> - 1
   Update
   - [Blog] Context should go away for Go 2
   <#m_395805729739486593_group_thread_3> - 3 Updates
   - How to setup go-swagger for an existing project to generate API docs
   <#m_395805729739486593_group_thread_4> - 1 Update
   - chaining contexts, best practices question
   <#m_395805729739486593_group_thread_5> - 1 Update
   - Go 1.9 Release Candidate 2 is released
   <#m_395805729739486593_group_thread_6> - 2 Updates
   - How to secure variables in memory?
   <#m_395805729739486593_group_thread_7> - 1 Update
   - "find" for Slices like "append" <#m_395805729739486593_group_thread_8>
   - 1 Update
   - Generics are overrated. <#m_395805729739486593_group_thread_9> - 1
   Update
   - Offline Go Documentation Tools <#m_395805729739486593_group_thread_10>
   - 2 Updates

A humble request/challenge

Jabari Zakiya : Aug 08 01:18PM -0700

Hi

I primarly use Ruby for math/science problems/projects because it's so easy
to program in, and it allows me to think about how to solve problems
without worrying about how to code it. I've also played around with Crystal
(aka Ruby on steroids) but it's still young, and doesn't let me (currently)
do what I want, or without a lot of hassles, and I've just recently started
looking at Nim (less than a month at time of writing).

I heard about Go for sometime but never had any time/reason to learn it.
But now maybe I have incentive to do so.

I developed a prime sieve called the *Sieve of Zakiya (SoZ)*, and it's
companion the *Segmented Sieve of Zakiya (SSoZ)*. I wrote a paper, **The
Segmented Sieve of Zakiya (SSoZ)** which describes its mathematical
foundations and algorithm, and provide a working C++ implementation at the
end of the paper (compiled, run, and verified), though I don't consider
myself a C++ programmer, just funcitonal enough in it. It's a relatively
short program.

Here's a link to read and download the paper:

https://www.scribd.com/doc/228155369/The-Segmented-Sieve-of-Zakiya-SSoZ

My humble request/challenge is for a/some skilled Golanger(?) to translate
the code into idiomatic Go to demonstrate the best way to code the
algorithm in it. Extra points if someone can do a true parallel version of
the algorithm, which I attempted to do using OpemMP, but what I did didnt'
seem to make the code faster than the serial version (see paper).

I assume coding this the *Go way* would look different than the C++ code,
and be quite different than a direct translation into Go using the same
(probably suboptimal) structure.

Ultimately, I'd like to publish the results of benchmarks in different
languages doing the SSoZ in an updated paper.

If anyone would be willing to take up the challenge I'd be pleased to
answer any questions the best I can.

Thanks in advance.

Jabari
Pierpaolo Bernardi : Aug 09 12:31AM +0200

Hello,

> Here's a link to read and download the paper:

> https://www.scribd.com/doc/228155369/The-Segmented-Sieve-of-Zakiya-SSoZ

Downloading the paper requires a scribd account which costs money(*).
Is the paper available for free somewhere else?

(*) Or one can use the free month they offer, but misteriously to get
a free month they require you give them your credit card number.

Cheers!
Jan Mercl <0xj...@gmail.com>: Aug 08 10:40PM

On Wed, Aug 9, 2017 at 12:32 AM Pierpaolo Bernardi 
wrote:

> Downloading the paper requires a scribd account which costs money(*).
> Is the paper available for free somewhere else?

My 2-minute skimming smells quite crackpot-ish
 (#25). Or maybe it's a
download-fee scam?

Check also:
https://www.google.com/search?q=%22humble+request%22+%22The+
Segmented+Sieve+of+Zakiya%22=%22humble+request%22+%
22The+Segmented+Sieve+of+Zakiya%22

-- 

-j
Michael Jones : Aug 08 03:45PM -0700

I remember a segmented wheel of Aitkin implementation. Maybe you can start
with that.

here are a few: https://golanglibs.com/top?q=sieve


On Tue, Aug 8, 2017 at 3:31 PM, Pierpaolo Bernardi 

[go-nuts] help with termbox-go

2016-10-30 Thread Robert Solomon
Hi.  I am learning go, and have no trouble w/ the CLI interface on either
Ubuntu 16.04-64 bit or win10-64 bit.
However, I am trying to learn termbox-go.  My simple hello world works on
Ubuntu but does not on win10.
First time I tried this on win10, I got a runtime error about a deadlock
situation.  I re-compiled and now all I get is a program that does not show
the termbox.

package main;

import (
"fmt"
"os"
"bufio"
tb "github.com/nsf/termbox-go"
"runtime"
   )

func print_tb(x,y int, fg,bg tb.Attribute, msg string) {
  for _,c := range msg {
tb.SetCell(x,y,c,fg,bg);
x++;
  }
}

func printf_tb(x,y int, fg,bg tb.Attribute, format string, args
...interface{}) {
  s := fmt.Sprintf(format,args...);
  print_tb(x,y,fg,bg,s);
}


func main() {
  var x,y int;
  var fg,fgBold,bg tb.Attribute;


  fmt.Println(" On", runtime.GOOS,", ARCH =",runtime.GOARCH,".  Press any
key to .");
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Scan();
  _ = scanner.Text();

  err := tb.Init();
  if err != nil {
fmt.Println(" Init call to termbox-go failed with error:",err);
os.Exit(1);
  }
  defer tb.Close();

  x = 0;
  y = 0;

  fg = tb.ColorYellow;
  fgBold = tb.ColorYellow | tb.AttrBold;
  fgcyan := tb.ColorCyan
  fgboldcyan := tb.ColorCyan | tb.AttrBold;
  fgblue := tb.ColorBlue
  fgboldblue := tb.ColorBlue | tb.AttrBold;
  bg = tb.ColorBlack;
  err = tb.Clear(fg,bg);
  if err != nil {
fmt.Println(" First Clear call to termbox-go Clear failed with
error:",err);
os.Exit(1);
  }
  print_tb(x,y,fg,bg,"Hello World in Yellow");
  y++
  print_tb(x,y,fgBold,bg,"Hello World in Bold Yellow.");
  y++
  print_tb(x,y,fgcyan,bg,"Hello World in Cyan");
  y++
  print_tb(x,y,fgboldcyan,bg,"Hello World in Bold Cyan");
  y++
  print_tb(x,y,fgblue,bg,"Hello World in Blue");
  y++
  print_tb(x,y,fgboldblue,bg,"Hello World in Bold Blue, and then hit any
key to exit");
  err = tb.Flush();
  if err != nil {
panic(err);
  }
  event := tb.PollEvent();
  switch event.Type {
  case tb.EventKey:
  case tb.EventResize:
  case tb.EventNone:
  default:
  }

}
Thanks for your help

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Newbie Struggling w/ Hashing

2016-09-19 Thread Robert Solomon
Hi.  I'm trying to learn Go after many years of using a different
language.  My development machine runs Ubuntu 16.04 amd64, go 1.6.2
linux/amd

I compared the output of the following code, and my output differs from the
std utilities such as sha1sum, sha215sum, etc.  I used
go1.6.3.windows-386.msi as my test file.

I also noticed that the hashes that were output were different, depending
on the value I set for my ReadBufferSize.  I don't understand why the
output I'm seeing doesn't match the std utilities, and why the hashes vary
w/ my buffer size.

Thanks,
Rob Solomon

package main;

import (
"os"
"fmt"
"runtime"
"encoding/hex"
"crypto/sha512"
"crypto/sha256"
"crypto/sha1"
"crypto/md5"
"io"
"hash"
"getcommandline"   // this one's mine.
)

func main() {

  const K = 1024;
  const M = 1024*1024;

  const (
 md5hash = iota
 sha1hash
 sha256hash
 sha384hash
 sha512hash
 HashType
);

  const ReadBufferSize = 10 * M;

  var HashName = [...]string{"md5","sha1","sha256","sha384","sha512"};
  var WhichHash int;
  var hasher hash.Hash;
  var FileSize int64;


  if len(os.Args) <= 1 {
fmt.Println(" Need input filename as a param. ");
os.Exit(0);
  }
  FileToHash := getcommandline.GetCommandLineString();

  fmt.Println();
  fmt.Print(" GOOS =",runtime.GOOS,".  ARCH=",runtime.GOARCH);
  fmt.Println("  WhichHash = ",HashName[WhichHash]);
  fmt.Println();
  fmt.Println();

  for {
FileSize = 0;

/* Create Hash Section */
TargetFile,readErr := os.Open(FileToHash);
check(readErr," Error opening FileToHash.");
defer TargetFile.Close();

switch WhichHash { // Initialing case switch on WhichHash
case md5hash :
   hasher = md5.New();
case sha1hash :
   hasher = sha1.New();
case sha256hash :
   hasher = sha256.New();
case sha384hash :
   hasher = sha512.New384();
case sha512hash :
   hasher = sha512.New();
default:
   hasher = sha256.New();
} /* initializing case on WhichHash */

FileReadBuffer := make([]byte,ReadBufferSize);
for {   // Repeat Until eof loop.
  n,err := TargetFile.Read(FileReadBuffer);
  if n == 0 || err == io.EOF { break }
  check(err," Unexpected error while reading the target file on which
to compute the hash,");
  hasher.Write(FileReadBuffer);
  FileSize += int64(n);
} // Repeat Until TargetFile.eof loop;

HashValueComputedStr := hex.EncodeToString(hasher.Sum(nil));

fmt.Println(" Filename  = ",FileToHash,", FileSize = ",FileSize,",
",HashName[WhichHash]," computed hash string, followed by hash string in
the file are : ");
fmt.Println(" Computed hash hex encoded:",HashValueComputedStr);

TargetFile.Close(); // Close the handle to allow opening a target
from the next line, if there is one.
fmt.Println();
fmt.Println();

WhichHash++
if WhichHash > sha512hash {break}
  }   /* outer LOOP */

  fmt.Println();
}

// --- check
---
func check(e error, msg string) {
  if e != nil {
fmt.Errorf("%s : ",msg);
panic(e);
  }
}

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Win xp

2016-08-30 Thread Robert Solomon
I'm just learning go. I wrote a trivial pgm on a Windows 10 machine. I
noticed that the exe file runs on Windows 7 and 10 but not XP.

Is that by design?

Robert Solomon

On Aug 30, 2016 2:21 PM, <golang-nuts@googlegroups.com> wrote:

golang-nuts@googlegroups.com
<https://groups.google.com/forum/?utm_source=digest_medium=email#!forum/golang-nuts/topics>
Google
Groups
<https://groups.google.com/forum/?utm_source=digest_medium=email/#!overview>
<https://groups.google.com/forum/?utm_source=digest_medium=email/#!overview>
Topic digest
View all topics
<https://groups.google.com/forum/?utm_source=digest_medium=email#!forum/golang-nuts/topics>

   - In case you missed it: language benchmarks for Go 1.7, and language
   adoption <#m_755194757400116849_group_thread_0> - 8 Updates
   - dynamic frequency ticker <#m_755194757400116849_group_thread_1> - 1
   Update
   - Go package management committee <#m_755194757400116849_group_thread_2>
   - 1 Update
   - Creating a crash dump file with Go and C stack traces
   <#m_755194757400116849_group_thread_3> - 2 Updates
   - asm newbie questions: missing stackmap
   <#m_755194757400116849_group_thread_4> - 2 Updates
   - labeled loop vs for statement inlining
   <#m_755194757400116849_group_thread_5> - 2 Updates
   - reading with scanner.Bytes() <#m_755194757400116849_group_thread_6> - 4
   Updates
   - certificates at /etc/ssl/certs/ getting ignored on FreeBSD
   <#m_755194757400116849_group_thread_7> - 3 Updates
   - Performance Counters <#m_755194757400116849_group_thread_8> - 1 Update
   - Behavior of calling (Context).Err without calling (Context).Done
   <#m_755194757400116849_group_thread_9> - 1 Update

In case you missed it: language benchmarks for Go 1.7, and language
adoption
<http://groups.google.com/group/golang-nuts/t/772ab7cf9756aab7?utm_source=digest_medium=email>
Eric Johnson <e...@tibco.com>: Aug 29 04:51PM -0700

Not that I think these account for much, but sort of fun to point at:

https://benchmarksgame.alioth.debian.org/u64q/go.html
(Short summary - now with Go 1.7, Go is faster for most benchmarks.)

And then, for language adoption, the TIOBE language index for August of
2016:
http://www.tiobe.com/tiobe-index/

(Note that the above is updated every six months, and I've not been able to
find a link to previous versions of the reports, however, you can look for
the trend for Go itself http://www.tiobe.com/tiobe-index/go/ ).
Go finally breaks into the top twenty.

As with any metrics, these are selective measures, and not really good
indicators by themselves. But at least they're positive with respect to Go.

Eric.
Ian Lance Taylor <i...@golang.org>: Aug 29 05:22PM -0700

On Mon, Aug 29, 2016 at 4:51 PM, 'Eric Johnson' via golang-nuts
> find a link to previous versions of the reports, however, you can look for
> the trend for Go itself http://www.tiobe.com/tiobe-index/go/ ).
> Go finally breaks into the top twenty.

It's because they changed their definition of Go. Quoting from
farther down the page: "The restriction "Google" has been removed from
the search queries for the programming language Go. Ilja Heilager
sorted out that without the search term "Google" the resulting Go hits
are still referring to the Go language. After having removed this
restriction Go jumped from position #55 to #20. Thanks Ilja!"

Ian
Eric Johnson <e...@tibco.com>: Aug 29 06:25PM -0700

Well, sure. I read that too. I think it is still useful that my intuition
that Go is gaining adoption aligns with what prominent metrics are
reporting, even if it is because the reporting changed how they measured.

Eric.

Asit Dhal <dhal.as...@gmail.com>: Aug 29 06:36PM -0700

Hi,

Go1.7 is faster in most benchmarks, but still slower than Java in some
benchmarks(like Go 1.6).
GO Garbage Collector needs time to become mature like JVM.

K-nucleotide, binary tree, Regex-dna are bad for GO(lack of fast GC and
good standard libraries).

But, for me, Go is an awesome substitute of Python and C++.

Warm Regards,
Asit
http://asit-dhal.github.io

On Tuesday, August 30, 2016 at 1:51:42 AM UTC+2, Eric Johnson wrote:
Torsten Bronger <bron...@physik.rwth-aachen.de>: Aug 30 09:59AM +0200

Hallöchen!

'Eric Johnson' via golang-nuts writes:


> And then, for language adoption, the TIOBE language index for August of
> 2016:
> http://www.tiobe.com/tiobe-index/

I don't think TIOBE is useful beyond position 10 or so. Anyway ...

https://www.openhub.net/languages/compare?utf8=%E2%9C%
93=commits_name%5B%5D=c_name%5B%
5D=golang_name%5B%5D=java_name%5B%5D=rust&
language_name%5B%5D=-1=Update

is limited to open source, but covers a big corpus. Besides,
"monthly commits" is a very expressive, clearly defined indicator.
Obviously, C is on a steep decline in the OSS world, while Go (you
may switch off the C line to see it better) is