Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-27 Thread Marvin Renich
* Kurtis Rader [240227 03:10]: > On Mon, Feb 26, 2024 at 11:52 PM tapi...@gmail.com > wrote: > > > On Tuesday, February 27, 2024 at 3:42:25 PM UTC+8 Jan Mercl wrote: > > > > On Tue, Feb 27, 2024 at 6:20 AM tapi...@gmail.com > > wrote: > > > > > From common sense, this is an obvious bug. But

Re: [go-nuts] When i try to input name from keyboard it is not taking the input

2024-02-20 Thread Marvin Renich
* Marvin Renich [240220 10:52]: > * Sagar Byahatti [240220 08:22]: > > package main > > > > import "fmt" > > > > func main() { > > > > var projectName = "APY" > > var sub = 50 > > > >

Re: [go-nuts] When i try to input name from keyboard it is not taking the input

2024-02-20 Thread Marvin Renich
* Sagar Byahatti [240220 08:22]: > package main > > import "fmt" > > func main() { > > var projectName = "APY" > var sub = 50 > > fmt.Println("Welcome to", projectName, " the number of subscriber is ", > sub) > fmt.Println("Enter your name: ") > var userName string > >

Re: [go-nuts] "yield" is backwards

2024-02-07 Thread Marvin Renich
* mspre...@gmail.com [240207 10:43]: > The go language is getting better and better for functional programming, > and I am here for it. I have enjoyed using APL, Scheme, Python. I was > excited to see https://go.dev/wiki/RangefuncExperiment . However, I am > puzzled by the choice to name the

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-15 Thread Marvin Renich
* Robert Engels [231115 12:29]: > What I’m suggesting is that imagine a dev changes that code and has > version() access the request property… Okay, that makes sense. > This is why if you are sharing data in a concurrent way you need to be > very careful of all usages. Absolutely. > The

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-15 Thread Marvin Renich
* Robert Engels [231114 21:55]: >Switching to pointer receivers everywhere actually makes this worse. Any >access is potentially a data race.  >It stills seems like this is a compiler issue. There needs to be a way to >synchronize the pointer to value copy in conjunction with

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-15 Thread Marvin Renich
* burak serdar [231114 19:09]: > I do not agree that this is because how the compiler works. A value > receiver is equivalent to pass-by-value argument, that is: > > rcp.version() > > is equivalent to: > > RPC.version(rpc) > > thus, creating the copy of the rpc variable. So, the compiler may

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread Marvin Renich
* David N [230724 01:11]: > I've posted this question on stackoverflow > , > discussed it with some members of the golang community, and I was > encouraged to post here. > > Problem:

Re: [go-nuts] Re: Gorilla toolkit - mux with http.FileServer returning 404

2023-03-22 Thread Marvin Renich
* zhiwei dong [230322 00:47]: > The 127.0.0.1:8084/apidoc/ return a 404 > > Demo > package main > > import ( > "fmt" > "github.com/gorilla/mux" > "net/http" > ) > > func main() { > router := mux.NewRouter() > router.PathPrefix("/apidoc/").Handler(http.StripPrefix("/apidoc/", >

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread Marvin Renich
* 'Mark' via golang-nuts [221201 05:17]: > I tried that and it works in the playground, and I added more types and it > still works in the playground . > But in my program it still doesn't work:-( > The actual code is here tdb-go

Re: [go-nuts] Understanding some gotchas with linking slices together via indexing

2022-11-02 Thread Marvin Renich
* Brian, son of Bob [221102 00:49]: > Can anyone explain these gotchas (demo )? > I've tried reading articles on this [one , > two > ] > > but

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

2022-10-28 Thread Marvin Renich
* 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

Re: [go-nuts] what is the origin of Go's reference time system?

2022-10-27 Thread Marvin Renich
* Ayan George [221026 13:51]: > > I'm really impressed by the simplicity of Go's time formatting and parsing > mechanisms -- particularly when compared with strftim(). I have to disagree. This is the most egregious design flaw of the standard library, and the second worst design flaw of the

Re: [go-nuts] Re: behavior of %f

2022-10-11 Thread Marvin Renich
* Dante Castagnoli [221010 18:01]: > Thanks! > > It's not lost, though. It shows up with the %g form. > > Knowing about %g, my issue is not extant, but others might hit it. I'm > relatively new to floating point issues, and I saw numbers showing up as > integers, and it took a while to sort

Re: [go-nuts] How to implement LogonUserA function (winbase.h)?

2022-09-01 Thread Marvin Renich
* Chandan Kumar [220901 07:29]: > Hi, > > I am trying to implement a program in which I need the function *LogonUserA > function (winbase.h) *from windows API and this function is not available > in the package *golang.org/x/sys/windows* so any advice would be helpful. First, you need to

Re: [go-nuts] Testing custom error type (error type in struct)

2022-09-01 Thread Marvin Renich
* Bagas Sanjaya [220901 06:04]: > > ``` > package tester > > import ( > "testing" > ) > > type Tests struct { > err error > } > > func TestErr (t *testing.T) { > cases := Tests{eTest,} ^ This is at least one of the problems. You must create an

Re: [go-nuts] Re: Do I need a reentrant locks?

2022-07-05 Thread Marvin Renich
* atd...@gmail.com [220705 10:03]: > :) That's what the asterisked note was for in the original question. I > don't think I can do that in the real code because the real code is much > more complex. Each node actually triggers a callback that may modify > another node. That callback is

Re: [go-nuts] Re: Do I need a reentrant locks?

2022-07-05 Thread Marvin Renich
* Brian Candler [220705 09:48]: > Have a public Set() that does the lock and then calls a private internal > function, which assumes it's already running under the lock. > https://go.dev/play/p/M1XuC8bxCxL > > On Tuesday, 5 July 2022 at 13:32:26 UTC+1 atd...@gmail.com wrote: > > > Hi, > > > >

Re: [go-nuts] Re: Ignore stale read errors from the race detector

2022-06-11 Thread Marvin Renich
* Jeff Learman [220610 13:23]: > Unlike C, Go has no `volatile` keyword. Therefore, the compiler is allowed > to cache a value that is never updated in the scope that it sees, and > there's no way for us to tell it not to do that. Actually, sync/atomic does essentially the same thing that

Re: [go-nuts] Re: Which is the most efficient way to read STDIN lines 100s of MB long and tens of MB info is passed to it?

2022-05-10 Thread Marvin Renich
* Amnon [220510 12:52]: > > I'm not sure why w.Write would freeze; is your process starting to swap > > and it is not really frozen but just taking a long time? Is it being > > killed by the kernel's out-of-memory monitor? > > In the OP's code, w.Write was writing a large amount of data to a

Re: [go-nuts] Re: Which is the most efficient way to read STDIN lines 100s of MB long and tens of MB info is passed to it?

2022-05-10 Thread Marvin Renich
* Const V [220508 17:20]: > Using r.ReadLine repeatedly I was able to read the full line in memory. It > is working very fast. > > for isPrefix && err == nil { > line, isPrefix, err = r.ReadLine() > ln = append(ln, line...) > } > > if strings.Contains(s, "error") { > > finds the substring

Re: [go-nuts] go fails to detect a point-time race condition

2022-04-30 Thread Marvin Renich
* Zhaoxun Yan [220430 02:29]: > Hi Dan! > > I did as you told, but go build -race still not functions: No, Dan said you must build with -race and then execute the output from the build: $ go build race race2 $ ./race2 What Dan was saying is that «go build -race» does _not_ detect races

Re: [go-nuts] evaluation of range expression in for-range loop

2022-03-18 Thread Marvin Renich
[Sorry, I accidentally set the Reply-To incorrectly in my previous msg; corrected here. I don't need a CC in responses.] * Jan Mercl <0xj...@gmail.com> [220318 12:04]: > On Fri, Mar 18, 2022 at 4:53 PM 'Axel Wagner' via golang-nuts > wrote: > > I don't really know the answer to your question. I

Re: [go-nuts] evaluation of range expression in for-range loop

2022-03-18 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [220318 08:04]: > https://go.dev/ref/spec#Length_and_capacity says: > > > The expression len(s) is constant if s is a string constant. The > > expressions len(s) and cap(s) are constants if the type of s is an array or > > pointer to an array and the expression s

Re: [go-nuts] Inconsistency between calls to "os.Chtimes()" and "stat.Sys().(syscall.Stat_t).Mtimespec"

2021-10-15 Thread Marvin Renich
* Marvin Renich [211015 08:04]: > Also note that different filesystems on the same running host can have > different resolutions. FAT filesystems (e.g. USB memory sticks) have > only 2-second resolution, while ext2 is, I think, 1 millisecond, and > ext4 is 1 nanosecond. Acc

Re: [go-nuts] Inconsistency between calls to "os.Chtimes()" and "stat.Sys().(syscall.Stat_t).Mtimespec"

2021-10-15 Thread Marvin Renich
* Kurtis Rader [211014 13:22]: > Note that file timestamp resolution depends on the system: both hardware > and OS. Even when using the same OS (e.g., Linux) on the same hardware the > resolution might be different due to how the OS kernel was built. I'm not > aware of any system that provides

Re: [go-nuts] What's going on while using "append" in memory?

2021-08-10 Thread Marvin Renich
* Henry [210810 01:26]: > Just sharing some tips. > > When working with slices, it is often a good idea to lend a helping hand to > the compiler. > > Don't declare something like this, unless you have no other choices. > ``` > var slice []int > ``` I believe this is bad advice. First, if

Re: [go-nuts] Re: How to implement this in golang?

2021-06-29 Thread Marvin Renich
[Please do not send images of text; copy and paste as text into the message or into text attachments.] * LetGo [210629 11:25]: > Thanks for the answer! (: > In python it was straightforward to implement and it works like a charm. It > sends small packets with delay between each other without

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-08 Thread Marvin Renich
* Robert Engels [210608 18:30]: > I think the playground code I supplied is essentially a test case - > and it works in the absence of concurrency or other held references > (like putting it in a map). But it is one simple test case, not an appropriate set of tests. Saying that code passes one

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-08 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [210608 02:54]: > On Tue, Jun 8, 2021 at 6:36 AM Marvin Renich wrote: > > > You say that test cases of Log work fine, but they are only fine in a > > non-concurrent environment. The instant you test Log (without > > interfaces) in a con

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-07 Thread Marvin Renich
* Robert Engels [210607 21:18]: > (I think you pasted the wrong link - that is my code). subsequent correction acknowledged; assuming the following discussion is about https://play.golang.org/p/-f73t_Pm7ur > It is not about being unwilling to admit it. Your > explanation/reasoning has not

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-07 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [210607 19:06]: > Well, it seems a bad idea to say that interfaces are implicitly pointers > then. That seems to indicate that Rob's original phrasing is indeed an > important clarification - the language behaves as if the value contained in > them is copied when

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-07 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [210607 10:19]: > FWIW I do tend to mix value and pointer receivers occasionally. > Sometimes a type needs a pointer receiver in one method, but a different > method doesn't and it's more convenient to have a copy available for > temporary operations. Axel, I

Re: [go-nuts] Re: Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-06 Thread Marvin Renich
* Joshua [210606 16:52]: > > In most cases (or most cases in actual practice?) an interface can be > > thought of as a pointer, > > This is however, an implementation detail specific to the compiler you use > though, correct? Well, sort of, but really no. Whether the compiler wastefully

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-06 Thread Marvin Renich
* 'Dan Kortschak' via golang-nuts [210606 06:43]: > On Sun, 2021-06-06 at 03:17 -0700, Brian Candler wrote: > > When you assign a regular (non-pointer) value to an interface > > variable, it does take a copy of that value: > > https://play.golang.org/p/XyBREDL4BGw > > It depends on whether it's

Re: [go-nuts] extract Last 2 characters in go template

2021-05-30 Thread Marvin Renich
* Pawan Kumar [210530 08:03]: > Many thanks Marvin , really appreciate it. I intended, but forgot, to hint that your FuncMap could include a function that was more specific to your problem than the sub function. ...Marvin -- You received this message because you are subscribed to the Google

Re: [go-nuts] extract Last 2 characters in go template

2021-05-28 Thread Marvin Renich
* Pawan Kumar [210528 12:43]: > Hi Team, > > I was using slice function to extract last 2 characters in go template but > not able to do ,as -ve range is not supported by slice function . > > For example - My cluster name is turbo-ab-03 , i can extract if i know > exact length of cluster

Re: [go-nuts] time.Format with "Month Year" format incorrectly displayed

2021-05-06 Thread Marvin Renich
* Kurtis Rader [210505 23:35]: > On Wed, May 5, 2021 at 8:23 PM Bagas Sanjaya wrote: > > > On 06/05/21 04.37, Ian Lance Taylor wrote: > > > You wrote 2009 where you need to write 2006. > > > > Wouldn't it possible to define arbitrary reference time and format it > > according to what it would

Re: [go-nuts] now that the election is over can we please remove the political ad for golang.org

2021-03-17 Thread Marvin Renich
* Jan Mercl <0xj...@gmail.com> [210317 06:27]: > On Wed, Mar 17, 2021 at 10:57 AM mortdeus wrote: > > I'm probably giving up any hopes to work for Google in the future by > writing this: +1. I find the banner deeply offensive, divisive and > excluding for people with dissenting views, regardless

Re: [go-nuts] Re: Compiler treatment of infinite loops

2021-03-05 Thread Marvin Renich
* Brian Candler [210305 10:21]: > There is a flip side to that: if you add the return statements, then > ForLoop1() gives an error due to unreachable code! > https://play.golang.org/p/0bajnJWTz7U > > So you can't win either way. I think this implies that if the behaviour > were changed now,

Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Jan Mercl <0xj...@gmail.com> [210120 15:27]: > On Wed, Jan 20, 2021 at 9:03 PM Marvin Renich wrote: > > > I still cannot find any mention of reserved import paths in any > > documentation (go help modules/importpath/gopath). It's just an issue > > on the tracke

Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Jan Mercl <0xj...@gmail.com> [210120 10:46]: > On Wed, Jan 20, 2021 at 3:57 PM Marvin Renich wrote: > > > I don't understand what you are saying. What is a "reserved import > > path" and where is it defined? > > See https://github.com/golang/go/issues/

Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Marvin Renich [210120 09:58]: > * Jan Mercl <0xj...@gmail.com> [210120 09:32]: > > On Wed, Jan 20, 2021 at 2:58 PM Marvin Renich wrote: > > > > > The error message is really incomplete, and therefore confusing. It > > > should be "package .

Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Jan Mercl <0xj...@gmail.com> [210120 09:32]: > On Wed, Jan 20, 2021 at 2:58 PM Marvin Renich wrote: > > > The error message is really incomplete, and therefore confusing. It > > should be "package ... is not in GOROOT or any element of GOPATH". > >

Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Alexander Mills [210119 16:54]: > i am getting this weird error message: > > package twitch/go-scripts/dynamo-creators-to-s3/lib is not in GOROOT > (/usr/local/Cellar/go/1.15.6/libexec/src/twitch/go-scripts/dynamo-creators-to-s3/lib) > > my GOPATH=$PWD/scripts/go > > so there is only 1

Re: [go-nuts] In Go the type size of 1 byte can reach 1 kilobyte, even 1 terabyte or much more.

2020-12-10 Thread Marvin Renich
* Christian Maurer [201210 07:37]: > > // Proof: Set n to a number >= 39 in the following program: > > func main() { > const ( > b = byte(0xc0) > n = 9 > ) > s := []string{string(b)} > for i := 0; i < n; i++ { > s = append(s, []string{""}...) > } > for i := 0; i < n; i++

Re: [go-nuts] Trying to call powershell script from Go

2020-10-27 Thread Marvin Renich
* Uzair Ally [201027 14:19]: > Hi Jake, > > The code I posted is the runnable go program just missing the powershell > script which is a separate file. Maybe I'm miss understanding? Is there > something else I can provide to help you understand further? Based on the your original message and

Re: [go-nuts] Trying to call powershell script from Go

2020-10-27 Thread Marvin Renich
mdName without the quotes: out, err := exec.Command(cmdName, "script.ps1").Output() I was just answering too fast. > On Tuesday, October 27, 2020 at 8:22:14 PM UTC+3 Marvin Renich wrote: > > > * Uzair Ally [201027 12:25]: > > > Hi, > > > > > &g

Re: [go-nuts] Trying to call powershell script from Go

2020-10-27 Thread Marvin Renich
* Uzair Ally [201027 12:25]: > Hi, > > I am getting the following error when I try to call a powershell script > from go. > > undefined: script > > Here is the code: > > cmdName := "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" > out, err := exec.Command("cmdName",

Re: [go-nuts] Should the program print true or false?

2020-09-17 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [200917 12:05]: > I think you might've intended this, which does indeed print true: > type S []S > var a, b S > a, b = S{0: b}, S{0: a} > fmt.Println(reflect.DeepEqual(a, b)) I was guessing he meant: type S []S var a, b S a = S{0: b} b = S{0: a}

Re: [go-nuts] Re: While implement ssh client using golang, record keyboard input

2020-09-15 Thread Marvin Renich
* sc3983...@gmail.com [200915 11:41]: > Hi Everyone: > > I have the same problem, How do I get user input command, with *SSH > client with a Interactive Shell* > > 在 2018年10月23日星期二 UTC+8上午4:57:50,Sun Frank写道: > > > > Hi Everyone: > > > > I came across a problem which puzzled me for

Re: [go-nuts] Definition of Method sets

2020-09-04 Thread Marvin Renich
* Yuu LongXue [200904 05:31]: > Hi all, > > I’m confused by the "method set" defined in go > specification,any one can help explain? > > The Go Programming Language Specification says that : > ``` > The method set of any other type T consists of all methods >

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-27 Thread Marvin Renich
* targe...@gmail.com [200827 05:40]: > On Thursday, August 27, 2020 at 12:20:59 PM UTC+3 axel.wa...@googlemail.com > wrote: >> I'm saying the current situation is less confusing than what you >> describe, yes. >> >> AIUI, with what you describe, if I have a variable `x` of type `*T` >> and an

Re: [go-nuts] Re: module confusion

2020-08-15 Thread Marvin Renich
* fge...@gmail.com [200815 03:44]: > On 8/15/20, Marvin Renich wrote: > > * Volker Dobler [200814 14:53]: > >> On Friday, 14 August 2020 20:39:37 UTC+2, K Richard Pixley wrote: > >> > Isn't this the default location? I just untarred the distribution... > &g

Re: [go-nuts] Re: module confusion

2020-08-14 Thread Marvin Renich
* Volker Dobler [200814 14:53]: > On Friday, 14 August 2020 20:39:37 UTC+2, K Richard Pixley wrote: > > Isn't this the default location? I just untarred the distribution... > > No. There is a reason https://golang.org/doc/install#install > states to do tar -C /usr/local -xzf

Re: [go-nuts] my package not include in go modules

2020-07-29 Thread Marvin Renich
* Ali Hassan [200725 01:04]: > I want to import libraries in module file but modules add all other > libraries except those packages which I had created, DB is one of them. How > to import? > Error , please help me > to resolve Also note

Re: [go-nuts] Expanding variables and fmt.Printf() issue

2020-06-29 Thread Marvin Renich
[pedantic correction] * Marvin Renich [200629 14:10]: > The final argument to Printf is []interface{}, while you are trying to ^ ...interface{} ...Marvin -- You received this message because you are subscribed to the Goo

Re: [go-nuts] Expanding variables and fmt.Printf() issue

2020-06-29 Thread Marvin Renich
* yves baumes [200629 03:22]: > Hello, > > considering this code > > ``` > package main > > import ( > "fmt" > ) > > func main() { > host := []string{"127", "0", "0", "1"} > > fmt.Printf("%v.%v.%v.%v\n", host[0], host[1], host[2], host[3]) > fmt.Printf("%v.%v.%v.%v\n", host[0:4]...) > } >

Re: [go-nuts] Re: accessibility of module version information in executable

2020-06-26 Thread Marvin Renich
* seank...@gmail.com [200626 12:31]: > go version -m $binary > > runtime/debug.BuildInfo Thanks much! I looked through runtime, but did not think to look at runtime/debug. I was completely unaware of the -m option to go version. ...Marvin -- You received this message because you are

[go-nuts] accessibility of module version information in executable

2020-06-26 Thread Marvin Renich
When building a command with go build that imports modules, does the resulting executable contain information about which modules are included as well as their versions? If so, is there a tool available to extract that information from the executable? Can the information be retrieved from within

Re: [go-nuts] Re: political fundraising on golang.org!

2020-06-19 Thread Marvin Renich
* Marvin Renich [200619 11:17]: > You post a banner within the Go community that is off topic and is ^ Just to be clear, the "you" in this paragraph is not you, Ian, personally. I am referring collectively to the maintainers of the web sites and mailing lists in their offici

Re: [go-nuts] Re: political fundraising on golang.org!

2020-06-19 Thread Marvin Renich
* Ian Lance Taylor [200619 00:20]: > It's an important discussion, but having it on golang-nuts is not working. > > It can continue off-list. You post a banner within the Go community that is off topic and is highly controversial (this thread is clear evidence of that). You then squelch

Re: [go-nuts] political fundraising on golang.org!

2020-06-15 Thread Marvin Renich
[Note To and CC] Please consider this a formal request for the Go Project Stewards to review the website banners being discussed in this thread and to make a determination that these banners are causing divisiveness in the Go Community and have offended some, and that the banners' content is

Re: [go-nuts] political fundraising on golang.org!

2020-06-15 Thread Marvin Renich
* Sam Whited [200615 09:34]: > This is an important issue about the Go Community and who feels welcomed > here, which is also covered by this mailing list. This is _so_ wrong. The evidence that this banner has caused substantial divisiveness and offended many members of the Go community is

Re: [go-nuts] political fundraising on golang.org!

2020-06-15 Thread Marvin Renich
* 'Axel Wagner' via golang-nuts [200614 20:15]: > No, what you said is, that objecting to the banner may not be *political*. > You didn't mention parties and neither did I. And I stand by my statement, > that objecting to the banner *is* inherently a political act. And that > claiming to object

Re: [go-nuts] Re: help understanding weird Benchmark results

2020-05-19 Thread Marvin Renich
* Warren Bare [200519 13:53]: > OK, I added a sum of the rand to the demo code and the results are the > same. Since it is displaying the sum, it seems clear that the code is not > optimized away. > > Again, I am NOT trying to time each iteration of the loop. This is a > minimal

Re: [go-nuts] Type Assertion on File type

2020-05-07 Thread Marvin Renich
* André kouamé [200507 12:57]: > I want to check, if the value return by my function has the type *os.File > This my code : > func createFile(filename string) (*os.File, error) { > f, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) > return f, err > > } > //Test code >

Re: [go-nuts] keyword func

2020-04-27 Thread Marvin Renich
* レミリア・スカーレット [200427 12:46]: > Why you need to write a "func sum(a, b int) int {...}", not "sum(a, b int) > int {...}"? > It seems to me that one could do without func keyword. I believe another reason is that the Go language designers decided that every top-level syntax element begins with a

Re: [go-nuts] Go Tour ok?

2020-04-21 Thread Marvin Renich
* Anssi Porttikivi [200421 08:57]: > I had to run the Go Tour locally, because the web version gives me odd > "timed out" and "build failed" (with no reason) errors > indeterministically... Is it just me? I was having the same trouble earlier today. The build (or run) was timing out, and the

Re: [go-nuts] Re: "Go build failed." in Go tour requires explicit Kill

2020-04-16 Thread Marvin Renich
* Brian Candler [200416 12:20]: > I've noticed this too. This is with the tour, rather than play.golang.org. > > To reproduce (I'm using Chrome 80 under macOS 10.14): > > * Go to a tour page which doesn't compile, e.g. > https://tour.golang.org/methods/25 > * Click Run > * At this point it

Re: [go-nuts] Re: wording in Go tour, methods/19

2020-04-16 Thread Marvin Renich
* Volker Dobler [200416 02:28]: > On Wednesday, 15 April 2020 17:58:11 UTC+2, Marvin Renich wrote: > > > > In the Go tour at https://tour.golang.org/methods/19 it says > > > > The error type is a built-in interface similar to fmt.Stringer: > > I agree

[go-nuts] "Go build failed." in Go tour requires explicit Kill

2020-04-15 Thread Marvin Renich
In the Go tour, what is the purpose of requiring the user to explicitly press the "Kill" button when the build fails? This seems completely unnecessary to me. If this is just a natural consequence of the internal implementation, it would, in my opinion, be well worth the effort to make a failed

[go-nuts] wording in Go tour, methods/19

2020-04-15 Thread Marvin Renich
In the Go tour at https://tour.golang.org/methods/19 it says The error type is a built-in interface similar to fmt.Stringer: The words closest to "similar to" are "built-in interface", implying that the way error is similar to fmt.Stringer is that it is a built-in interface, which it clearly

Re: [go-nuts] go run requires internet connection?

2020-04-08 Thread Marvin Renich
* Tanmay Das [200408 12:17]: > Hey Gophers, > My very first post here. > > Today I faced an unexpected power outage and I wanted to tinker with Go a > little bit. I wrote a simple hello world program and ran > go run helloworld.go > > Strangely the code didn't run. In fact, the terminal

Re: [go-nuts] Should it panic when set a channel to nil concurrently

2020-03-02 Thread Marvin Renich
* Yuan Ting [200301 23:50]: > I write a simple program likes below and it triggers a data race alarm with > -race flag. But no matter how I run, this program will not panic. I know it > is legal to receive messages from nil channels, but I don't quite > understand why this program does not

Re: [go-nuts] doubt about reflect.Type.String and empty interface

2020-01-07 Thread Marvin Renich
* Manlio Perillo [200106 18:57]: > I wrote another test https://play.golang.org/p/hoTAnijCfg1. > Now it is clear why the first entry can only print nil for the type > and for the value. > > However printf %v verb prints nil for both an empty interface and an > interface with a dynamic value of

Re: [go-nuts] Re: bufio.Reader.Buffered returns 0

2019-12-16 Thread Marvin Renich
* Ian Lance Taylor [191215 23:05]: > The Buffered method [snip] tells you how > many bytes you can Read without causing a call to the underlying > Reader. I think this would be a significant improvement over the current ambiguous documentation. It should adequately dispel any unrealistic

Re: [go-nuts] Re: What is the correct way to access/modify slice elements concurrently

2019-11-13 Thread Marvin Renich
* burak serdar [191112 12:45]: > Is there a guarantee that the compiler will not reorganize > instructions around an atomic read/write? That is: > > i++ > k:=atomic.AddInt32(,1) > > Is there a guarantee that the compiler won't rewrite this as: > > k:=atomic.AddInt32(,1) > i++ First, from one

Re: [go-nuts] Re: What is the correct way to access/modify slice elements concurrently

2019-11-12 Thread Marvin Renich
* Robert Engels [191112 12:59]: > The bug I referenced discusses the current problem with the MM > specification. You are making assumptions that are not supported by > the current MM, but as the bug points out, that is the current > behavior. I can see that point of view, and I don't think it

Re: [go-nuts] What is the correct way to access/modify slice elements concurrently

2019-11-12 Thread Marvin Renich
* Robert Engels [191112 13:44]: > Sorry, at work so I need to use the 'web mail' interface and it > doesn't appear to be including them when I reply. Understood. I'll just try to follow the threading as best as I can. ...Marvin -- You received this message because you are subscribed to the

Re: [go-nuts] What is the correct way to access/modify slice elements concurrently

2019-11-12 Thread Marvin Renich
that display messages from the same thread together. Does your MUA not add this header???] * Robert Engels [191112 13:00]: > This is not the issue I am referring to, I am referring to > https://github.com/golang/go/issues/5045 > > -Original Message----- > >From: Marvin Renich >

Re: [go-nuts] What is the correct way to access/modify slice elements concurrently

2019-11-12 Thread Marvin Renich
[I almost missed this post because you did not reply to the thread.] * Robert Engels [191108 11:41]: > See https://github.com/golang/go/issues/10958 for using atomics in > tight/busy-wait loops. This doesn't have anything to do with atomics. Atomic operations are just one of many, many things

Re: [go-nuts] Re: What is the correct way to access/modify slice elements concurrently

2019-11-12 Thread Marvin Renich
There are two different viewpoints you can take. Either the Go Memory Model must stand alone, and any concurrency claims made by the language and standard library must be based on the limited set of operations defined in the GMM, or the GMM provides the definitions and provides a substantial, but

Re: [go-nuts] What is the correct way to access/modify slice elements concurrently

2019-11-08 Thread Marvin Renich
* burak serdar [191108 08:42]: > I was thinking about this. In general, it should be safe to replace > > Lock() > read/write one value > Unlock() > > with > > AtomicRead/Write > > Is that correct? The go memory model does not say anything about this. Yes. While others have argued that the

Re: [go-nuts] What is the correct way to access/modify slice elements concurrently

2019-11-08 Thread Marvin Renich
* Kasun Vithanage [191107 23:47]: > type Foo struct { > Alive bool > } > > type Bar struct { > Foos []*Foo > } > > func (b *Bar) CheckFoosAlive() { > for i := 0; i < len(b.Foos); i++ { > if b.Foos[i].Alive { > fmt.Println("Alive") > } > } > } > > func (b* Bar)

Re: [go-nuts] Need advice on AST formatting

2019-10-28 Thread Marvin Renich
* roger peppe [191028 04:49]: > On Sun, 27 Oct 2019, 02:52 Marvin Renich, wrote: > > I strongly encourage you to use > > > > var fset = token.NewFileSet() > > > > rather than > > > > fset := token.NewFileSet() > > > > Those two altern

Re: [go-nuts] Need advice on AST formatting

2019-10-26 Thread Marvin Renich
* Denis Cheremisov [191026 06:09]: > The answer was simple: > > var fset token.FileSet – wrong > > fset := token.NewFileSet() – right I believe I am in the minority here, but I am not a singleton minority. There are at least several of us who agree that «var» should be used over «:=» whenever

Re: [go-nuts] Re: Static methods

2019-10-18 Thread Marvin Renich
First, let me apologize for writing in a way that you took to be aggressive. That was definitely not my intention. My state of mind when I wrote it was conversational, not antagonistic, and I did not realize you would interpret it any other way. * gera...@cloudoki.com [191018 11:08]: > hey,

Re: [go-nuts] Re: Static methods

2019-10-16 Thread Marvin Renich
* gera...@cloudoki.com [191016 11:03]: > I'm not sure about its *idiomacity*, but namespacing should be a nice thing. > > On Tuesday, March 1, 2011 at 8:48:52 PM UTC, yiyus wrote: Do you realize you are responding to an eight-year-old thread? If you really feel a

Re: [go-nuts] Re: Extending an array 'The right way'. Guidence needed!

2019-10-15 Thread Marvin Renich
* thatipelli santhosh [191015 08:07]: > Hi Marvin, > > I am curious to know if we approx 10 ( we don't know exact amount of > slice entries) add to slice. Slice will grow based on our size of data > and underlying array size but doing this create multiple underlying arrays > (more memory

Re: [go-nuts] Re: Extending an array 'The right way'. Guidence needed!

2019-10-15 Thread Marvin Renich
P.S. If you are still having trouble after reading the responses to your query, use the go playground (https://play.golang.org/) to create a simple program that demonstrates what you are trying, and post the link you get from clicking the "Share" button, and explain what you would like the output

Re: [go-nuts] Re: Extending an array 'The right way'. Guidence needed!

2019-10-15 Thread Marvin Renich
[When you are replying to someone else's message, reply to that message, not your original message. Your reply lost the context of the message to which you were replying (Jan Mercl's).] * Stuart Davies [191015 07:24]: > My goal is to contain a list of integers that may extend to possibly a >

[go-nuts] WAIT_TIMEOUT inconsistency in golang.org/x/sys/windows

2019-09-26 Thread Marvin Renich
In golang.org/x/sys/windows, the WAIT_* return codes from WaitForSingleObject and WaitForMultipleObjects are defined as untyped integer constants except for WAIT_TIMEOUT, which is a syscall.Errno. All the other syscall.Errno values less than 1700 (the first RPC_ error) begin with ERROR_. The

Re: [go-nuts] Regarding strings replace functions issues

2019-08-27 Thread Marvin Renich
* Durga Someswararao G [190827 14:07]: > Hi, > > Can anyone help me in this case. > > I was reading byte data(array of bytes) from another process and converted > that data to string. Now I am trying to replace escape sequences \n with > strings.Replace function but golang not detecting it. >

Re: [go-nuts] Split a empty string will get a one element array?

2019-08-08 Thread Marvin Renich
* Kurtis Rader [190807 18:43]: > Please don't respond to threads that are seven years old. Having said that > the behavior is reasonable and the behavior you and the O.P. expect is not > reasonable. Consider the following examples: > > result := strings.Split("abc", "") > result :=

Re: [go-nuts] Testing using mock functionality

2019-07-22 Thread Marvin Renich
* wylderke...@gmail.com [190722 01:11]: > I'm new to go (and new to unit testing) and have a question about how to > test my code. I have a package that uses a library, with a kinda big > interface , let's > call it A. I don't use all the

Re: [go-nuts] Let's play

2019-07-12 Thread Marvin Renich
* Ali Hassan [190712 12:56]: > > If you curious about check out the link below > https://koohinoorgo.blogspot.com/2019/07/methods-bind-to-special-type-of-receiver.html The only thing about this message that does not look like a phishing or Trojan attack is the end of the URL. The subject and

Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread Marvin Renich
* nicolas_boiteux via golang-nuts [190626 13:19]: > /* > #include > #include > #include > extern void __stdcall RVExtension(char *output, int outputSize, const char > *function); > */ > > //export RVExtensionVersion > func RVExtensionVersion(output *C.char, outputsize C.size_t) { >

Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-26 Thread Marvin Renich
* nicolas_boiteux via golang-nuts [190626 12:15]: > i have some news. > > With this kind of declaration > extern void __fastcall RVExtension(char *output, int outputSize, const char > *function){ > goRVExtension(output, outputSize, function); > }; > as you can see in error message this

Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-23 Thread Marvin Renich
* nicolas_boiteux via golang-nuts [190623 15:33]: > Precisly, i don't know what is this @12, and nobody can explain this :( > It's for a windows build and the dll is load by arma game. The leading '_' and trailing '@' followed by a number is the __stdcall decoration for a C name in the produced

  1   2   3   >