Re: [go-nuts] Failure in file seek

2024-04-08 Thread Nikhilesh Susarla
,SeekCurrent,SeekEnd} > (0, 1 or 2). > go doc os.File.Seek > > On Apr 8, 2024, at 2:24 PM, Nikhilesh Susarla wrote: > > github/file-seek/main.go > <https://github.com/susarlanikhilesh/file-seek-failure/blob/main/main.go> > > I did write with ReadOnly also and

Re: [go-nuts] Failure in file seek

2024-04-08 Thread Nikhilesh Susarla
024, 3:33 PM Nikhilesh Susarla > wrote: > >> I wanted to seek around a file by opening it using read-only, but then I >> get this error called "Invalid argument" >> >> https://go-review.googlesource.com/c/go/+/14881 >> >> I read the above link

[go-nuts] Failure in file seek

2024-04-08 Thread Nikhilesh Susarla
I wanted to seek around a file by opening it using read-only, but then I get this error called "Invalid argument" https://go-review.googlesource.com/c/go/+/14881 I read the above link and they say it is not supported to seek around. I tried direct lseek in c language and it failed with same.

[go-nuts] Module vs Package

2024-04-01 Thread Nikhilesh Susarla
Packages are inside modules. Package is nothing but collection of go files under a folder of that package name But without modules also we can import packages. Can someone point out the exact and main difference between package vs modules in golang. Thank you -- You received this message

[go-nuts] go vet not erroring waitgroup inc used after done

2024-03-25 Thread Nikhilesh Susarla
Hello, // main.go package main import ( "sync" "time" ) func main() { var wg sync.WaitGroup go lolsleep() wg.Add(1) wg.Wait() } func lolsleep(wg *sync.WaitGroup) { wg.Done() time.Sleep(3 * time.Second) } go vet main.go Why isn't go vet complaining that wg.Add is happening after the

[go-nuts] How to resolve running go run with below error

2023-06-27 Thread Nikhilesh Susarla
I was creating a cli application. I was building, testing it and all of sudden I made few code changes and then I wanted to do go run main.go, it gives me below error. fork/exec C:\Users\cydri\AppData\Local\Temp\go-build2802953115\b001\exe\main.exe: Operation did not complete successfully

[go-nuts] Go routines consuming memory

2023-06-06 Thread Nikhilesh Susarla
I was going through a blog where they compare different language threads to see how much memory they consume for a million tasks. Blog : https://pkolaczk.github.io/memory-consumption-of-async/ Do we have any benchmarking/report before that Go routines take more memory with more threads? I

Re: [go-nuts] Runtime panic identification

2022-12-26 Thread Nikhilesh Susarla
So the SigPanic() captures the "_SIGSEGV" and then panics the whole program right? On Monday, 26 December 2022 at 23:49:12 UTC+5:30 Ian Lance Taylor wrote: > On Mon, Dec 26, 2022 at 9:49 AM Nikhilesh Susarla > wrote: > > > > https://play.golang.com/p/xpuit5lh9hh &g

[go-nuts] Runtime panic identification

2022-12-26 Thread Nikhilesh Susarla
Hello Gophers, https://play.golang.com/p/xpuit5lh9hh An array out of bounds throws panic at runtime. How does the internal runtime know that we are accessing the memory which we are not allocated? Interested in knowing more depth of the internals. This Link

[go-nuts] Get network interface values

2022-12-05 Thread Nikhilesh Susarla
Hi, I want to check if my system is connected to internet or not. 1. Say I may be connected to wifi but there is no internet. 2. Connected in lan but there is no internet So, I want a low level package to get the status of the network card or related in Go. Rather than just querying

[go-nuts] Re: Problems with array slicing reliability?

2022-11-23 Thread Nikhilesh Susarla
Before anyone takes a look, can you please place the code in https://go.dev/play/ and then share that link where the code compiles and if it works on the browser and you have specific settings for goarch and goos then gophers can take a look at it. Thank you On Thursday, 24 November 2022 at

[go-nuts] Re: Proposal for change type Duration int64

2022-11-22 Thread Nikhilesh Susarla
Got it. I was wrong. time.NewTicker would panic if duration is negative. But if the duration is used widely in negative then fine :) Thank you for correcting On Tuesday, 22 November 2022 at 16:03:58 UTC+5:30 Volker Dobler wrote: > On Tuesday, 22 November 2022 at 11:28:15 UTC+1

[go-nuts] Proposal for change type Duration int64

2022-11-22 Thread Nikhilesh Susarla
Hi, type Duration int64 The current Duration is int64 and the duration value should never be less than 0 else it will panic. It would be safe and advisable to change it to uint64 or so, where at least it would not cause panic. Is there any reason for not using uint? Thank you Susarla

[go-nuts] Int64 to []byte and vice-versa

2022-11-21 Thread Nikhilesh Susarla
Hi, I have an int64 value say 12 I want to convert that to []byte array. How do we do that. There were lot of ways on the internet. Nothing which golang specifies or has a built-package for direct conversions. Lot of them dealt with Endiean's, but that might cause issues to I believe. So, is

[go-nuts] Unicode variable name error

2022-11-05 Thread Nikhilesh Susarla
Hi, https://play.golang.com/p/uXOgD0PNc-p I was trying to declare unicode variable name as Go supports it. The language I used is Telugu. It's corresponding chart (https://unicode.org/charts/PDF/U0C00.pdf) But I get the compilation issue. Am I missing anything ? If I write Japanese variable

Re: [go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
; func (notQuiteEOF) Is(other error) bool { > return other == io.EOF > } > > This allows errors to be considered "the same" under `errors.Is`, while > not actually being the same and it's probably the recommended mechanism to > "imitate" an error from a di

Re: [go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
io/io.go;drc=90b40c0496440fbd57538eb4ba303164ed923d93;l=44 > > If the error is created by code other than your own, and that code does > not reuse the same error, then compare strings. > > > On Sat, Nov 5, 2022 at 12:39 PM Nikhilesh Susarla > wrote: > >> Oh I see. >>

Re: [go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
if package A chose the same >> error sentinel text as package B and suddenly their sentinels compare as >> equal. >> If you want error identity between values, you have to actually copy the >> error value (or implement your own, which may very well not do it this way). >

[go-nuts] Error Interfaces

2022-11-05 Thread Nikhilesh Susarla
Same interface comparison https://play.golang.com/p/9hHlTDosYzz Why is the equals too still returning false? Any more details on this? Thank you -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Local modules not updating in go.mod

2022-04-05 Thread Nikhilesh Susarla
Hi, I have a local package Z under X/Y folder So, to use the local package Z, I changed in the go.mod of the other package which wants to use it. replace X/Y/Z => ../Z After that if I run go mod tidy. This should ideally create an entry in requires with X/Y/Z

Re: [go-nuts] Example of printing in go.dev

2022-03-09 Thread Nikhilesh Susarla
Okay. I get it. When I ran through go playground I missed that type receiver was of pointer type, so I was not sure why it didn't print as mentioned in the docs Thank you On Thursday, 10 March 2022 at 09:00:49 UTC+5:30 kortschak wrote: > On Wed, 2022-03-09 at 19:16 -0800, Nikhilesh Susa

[go-nuts] Example of printing in go.dev

2022-03-09 Thread Nikhilesh Susarla
In https://go.dev/doc/effective_go#printing I saw an example for printing our custom string output for the type. The code below is from docs. func (t *T) String() string { return fmt.Sprintf("%d/%g/%q", t.a, t.b, t.c) } fmt.Printf("%v\n", t) But rather the statement should be this right?

[go-nuts] Handle errors in init

2022-03-09 Thread Nikhilesh Susarla
I have an init func in a package. Inside the init function, I have a database initialization which returns error. How can I handle that error failure incase if it fails in the init function. Thank you Nikhilesh -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: Using a local copy of an external package?

2022-02-09 Thread Nikhilesh Susarla
I did place them in go.work file only. I commented the package in go.mod file. On Wed, Feb 9, 2022 at 7:07 PM Manlio Perillo wrote: > The `use` directive must be added in the go.work file, not in the go.mod > file. > Also, you can use `go work use` command, instead of manually editing the >

Re: [go-nuts] Re: Using a local copy of an external package?

2022-02-09 Thread Nikhilesh Susarla
I updated the project. ran go work init cmd then added use ../go-bitswap replace github.com/ipfs/go-bitswap v0.5.1 => ../go-bitswap` and comment in my go.mod file. But when I run go mod tidy it comes back in the go.mod file. using go 1.18v workspace : D:\test\workspace hierarchy :

Re: [go-nuts] Re: Using a local copy of an external package?

2022-02-09 Thread Nikhilesh Susarla
> > I was trying to init the work file as instructed, but I have a package >> which still doesn't work in 1.18 >> >> [image: image.png] >> So, is there any other alternative? >> >> Thank you >> Susarla Nikhilesh >> > -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Using a local copy of an external package?

2022-02-08 Thread Nikhilesh Susarla
The replace works. But somehow lately I'm facing issue with replace. In my go.mod file I wrote replace for the package referring it to local package using ../package name But when I go do go mod tidy in that package, it brings back that package referring to the github.com in the require. I'm

[go-nuts] Golang Crypto Algo Compliance

2021-07-28 Thread Nikhilesh Susarla
Hello, Is there any documentation or a site where the crypto algos which are implemented in the crypto package has their relative compliance page? Example: crypto/rsa rsa.GenerateKey() Is there a page where the generation of the key is following FIPS compliant standards? If so please do