Re: [go-nuts] HTTP client - streaming POST body?

2023-03-22 Thread burak serdar
On Wed, Mar 22, 2023 at 8:32 PM 'Christian Stewart' via golang-nuts <
golang-nuts@googlegroups.com> wrote:

> you can achieve this using an io.Pipe. The io.Pipe function returns a
> connected pair of *PipeReader and *PipeWriter, where writes to the
> *PipeWriter are directly read from the *PipeReader. The Write call on the
> *PipeWriter will block until the data is read from the *PipeReader.
>
> pr, pw := io.Pipe()
>
> Pass the pr as the body and write to the pw.
>

And when you are done generating the content, close pw.

>
> On Wed, Mar 22, 2023, 7:06 PM 'Jim Smart' via golang-nuts <
> golang-nuts@googlegroups.com> wrote:
>
>> The issue here, isn’t that I am uploading a big file — that’s easy.
>>
>> As I said in my initial post:
>>
>> > The use case here is that I'm wishing to send very large UPDATE/INSERT
>> queries/commands to an HTTP endpoint, and the body content of those
>> queries/commands is actually generated from a database.
>>
>> The content I wish to push to the server, is /generated/ content. So
>> really what I want is a something I can directly write into.
>>
>> I am trying to avoid generating my upload content into a buffer first.
>> Because the data can be very large.
>>
>> — It’s easy to say “write a reader” but writing it as a reader involves
>> doing complete inversion of control on my code, and isn’t really feasible.
>> I can’t easily make the code I have which has complex logic to build the
>> upload data using Writes, into something that is then driven by Reads.
>>
>> Which is why I asked if it was possible to somehow Write straight down
>> the connection.
>>
>>
>> — Thanks for the suggestions all the same.
>>
>> /J
>>
>>
>> --
>> 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/C5B2823D-2458-4F91-A09D-6B12F74CD8B3%40jimsmart.org
>> .
>>
> --
> 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/CA%2Bh8R2pTUXsWPpywxhRJi_Bs3ZP0hmVP%3DkqZMe6FwJWJS-3BDg%40mail.gmail.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/CAMV2RqoO26VS-G05Y6U-b4VKJMUQPvMMun7SMZtbU0djJMQqEw%40mail.gmail.com.


Re: [go-nuts] HTTP client - streaming POST body?

2023-03-22 Thread 'Christian Stewart' via golang-nuts
you can achieve this using an io.Pipe. The io.Pipe function returns a
connected pair of *PipeReader and *PipeWriter, where writes to the
*PipeWriter are directly read from the *PipeReader. The Write call on the
*PipeWriter will block until the data is read from the *PipeReader.

pr, pw := io.Pipe()

Pass the pr as the body and write to the pw.

On Wed, Mar 22, 2023, 7:06 PM 'Jim Smart' via golang-nuts <
golang-nuts@googlegroups.com> wrote:

> The issue here, isn’t that I am uploading a big file — that’s easy.
>
> As I said in my initial post:
>
> > The use case here is that I'm wishing to send very large UPDATE/INSERT
> queries/commands to an HTTP endpoint, and the body content of those
> queries/commands is actually generated from a database.
>
> The content I wish to push to the server, is /generated/ content. So
> really what I want is a something I can directly write into.
>
> I am trying to avoid generating my upload content into a buffer first.
> Because the data can be very large.
>
> — It’s easy to say “write a reader” but writing it as a reader involves
> doing complete inversion of control on my code, and isn’t really feasible.
> I can’t easily make the code I have which has complex logic to build the
> upload data using Writes, into something that is then driven by Reads.
>
> Which is why I asked if it was possible to somehow Write straight down the
> connection.
>
>
> — Thanks for the suggestions all the same.
>
> /J
>
>
> --
> 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/C5B2823D-2458-4F91-A09D-6B12F74CD8B3%40jimsmart.org
> .
>

-- 
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/CA%2Bh8R2pTUXsWPpywxhRJi_Bs3ZP0hmVP%3DkqZMe6FwJWJS-3BDg%40mail.gmail.com.


Re: [go-nuts] HTTP client - streaming POST body?

2023-03-22 Thread 'Jim Smart' via golang-nuts
The issue here, isn’t that I am uploading a big file — that’s easy.

As I said in my initial post:

> The use case here is that I'm wishing to send very large UPDATE/INSERT 
> queries/commands to an HTTP endpoint, and the body content of those 
> queries/commands is actually generated from a database.

The content I wish to push to the server, is /generated/ content. So really 
what I want is a something I can directly write into.

I am trying to avoid generating my upload content into a buffer first. Because 
the data can be very large.

— It’s easy to say “write a reader” but writing it as a reader involves doing 
complete inversion of control on my code, and isn’t really feasible. I can’t 
easily make the code I have which has complex logic to build the upload data 
using Writes, into something that is then driven by Reads.

Which is why I asked if it was possible to somehow Write straight down the 
connection.


— Thanks for the suggestions all the same.

/J


-- 
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/C5B2823D-2458-4F91-A09D-6B12F74CD8B3%40jimsmart.org.


[go-nuts] httptest.ResponseRecorder and superfluous WriteHeader calls

2023-03-22 Thread TheDiveO
While maintaining my Go spaserve  
module for serving single-page applications with client-side DOM routing 
and on different routes simultaneously I noticed different logging behavior 
between http.timeoutWriter.WriteHeader 

 
and httptest.ResponseRecorder.WriteHeader 

.

While the "production" response writer explicitly logs and thus warns of 
superfluous WriteHeader calls, the testing response recorder doesn't and 
stays silent. I would have expected that an httptest response recorder 
would at least also log any superfluous calls, or better, somehow report 
such superfluous calls in a way that tests can check and fail where 
necessary.

Would it make sense to create a feature request issue for httptest?

What would be a good design to make httptest detect and preferably 
immediately report superfluous calls to WriteHeader in order immediately 
detect the "offending" call site? I recon that calling panic would be 
rather rude. Would an additional (new) "SuperfluousWriteHeader func()" 
struct field in ResponseRecorder be an acceptable proposal? 
SuperfluousWriteHeader would be called if non-nil and would be used by 
tests to wire into their particular testing harness.

Other ideas and suggestions?

Note bene: at the moment, I'm wrapping httptest's ResponseRecorder in my 
own WrappedResponseRecorder 
.
 
Maybe there's a better way to do this?

-- 
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/61c0dd07-e6d1-4008-936c-9a4c25be2fd2n%40googlegroups.com.


Re: [go-nuts] Issue with glog https://github.com/golang/glog/releases/tag/v1.1.0

2023-03-22 Thread 'Chressie Himpel' via golang-nuts
On Mon, Mar 20, 2023 at 6:07 PM Chressie Himpel  wrote:
>
> On Mon, Mar 20, 2023 at 4:44 PM chandra sekhar  
> wrote:
> >
> > Hi,
> > I see that you have already provided a fix for this issue 
> > https://github.com/golang/glog/commit/9c9801e69114b582b12aa7010c75fe2105ae23b3.
> > Any idea when you will make a new tag release with this fix?
>
> I have another fix in the pipeline that i would like to land before
> tagging a new release. It should be a matter of a few days. Thanks for
> your patience.

I just tagged https://github.com/golang/glog/releases/tag/v1.1.1 that
contains the fix.

>
> >
> > Regards,
> > Chandra R.
> >
> > On Thursday, March 16, 2023 at 9:17:20 PM UTC+2 Chressie Himpel wrote:
> >>
> >> On Thu, Mar 16, 2023 at 5:24 PM Ian Lance Taylor  wrote:
> >> >
> >> > [ + jba ]
> >> >
> >> > On Thu, Mar 16, 2023 at 8:56 AM Chandra S. Rangavajjula (Nokia)
> >> >  wrote:
> >> > >
> >> > > Hi,
> >> > > I am using glog in my application development. With the latest tag 
> >> > > (https://github.com/golang/glog/releases/tag/v1.1.0), there started a 
> >> > > new panic error with -vmodule. This issue was not there in older 
> >> > > version.
> >>
> >> Thanks for the report. The panic stems from the flag package trying to
> >> call .String on the mentioned glog.vModuleFlag type. I'll fix this
> >> internally and publish a new version soon.
> >>
> >> > >
> >> > > 
> >> > > Error:-
> >> > > 
> >> > > $./tst --help
> >> > > usage: example -stderrthreshold=[INFO|WARNING|FATAL] -log_dir=[string]
> >> > > -alsologtostderr
> >> > > log to standard error as well as files
> >> > > -log_backtrace_at value
> >> > > when logging hits line file:N, emit a stack trace
> >> > > -log_dir string
> >> > > If non-empty, write log files in this directory
> >> > > -log_link string
> >> > > If non-empty, add symbolic links in this directory to the log files
> >> > > -logbuflevel int
> >> > > Buffer log messages logged at this level or lower (-1 means don't 
> >> > > buffer; 0 means buffer INFO only; ...). Has limited applicability on 
> >> > > non-prod platforms.
> >> > > -logtostderr
> >> > > log to standard error instead of files
> >> > > -stderrthreshold value
> >> > > logs at or above this threshold go to stderr (default 2)
> >> > > -v value
> >> > > log level for V logs
> >> > > -vmodule value
> >> > > comma-separated list of pattern=N settings for file-filtered logging
> >> > >
> >> > > panic calling String method on zero glog.vModuleFlag for flag vmodule: 
> >> > > runtime error: invalid memory address or nil pointer dereference
> >> > >
> >> > > 
> >> > > Example code:-
> >> > > 
> >> > > package main
> >> > >
> >> > > import (
> >> > > "github.com/golang/glog"
> >> > > "os"
> >> > > "flag"
> >> > > "fmt"
> >> > > )
> >> > >
> >> > > func usage() {
> >> > > fmt.Fprintf(os.Stderr, "usage: example 
> >> > > -stderrthreshold=[INFO|WARNING|FATAL] -log_dir=[string]\n", )
> >> > > flag.PrintDefaults()
> >> > > os.Exit(2)
> >> > > }
> >> > >
> >> > > func init() {
> >> > > flag.Usage = usage
> >> > > // NOTE: This next line is key you have to call flag.Parse() for the 
> >> > > command line
> >> > > // options or "flags" that are defined in the glog module to be picked 
> >> > > up.
> >> > > flag.Parse()
> >> > > }
> >> > >
> >> > > func main() {
> >> > > number_of_lines := 10
> >> > > for i := 0; i < number_of_lines; i++ {
> >> > > glog.V(2).Infof("LINE: %d", i)
> >> > > message := fmt.Sprintf("TEST LINE: %d", i)
> >> > > glog.Error(message)
> >> > > }
> >> > > glog.Flush()
> >> > > }
> >> > > 
> >> > >
> >> > > Regards,
> >> > > Chandra R
> >> > >
> >> > > --
> >> > > 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/AS4PR07MB875652B4C33A66DF22D15C5BC3BC9%40AS4PR07MB8756.eurprd07.prod.outlook.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...@googlegroups.com.
> >> > To view this discussion on the web visit 
> >> > 

Re: [go-nuts] Can't capture stderr after upgrading to glog v1.1.0

2023-03-22 Thread 'Chressie Himpel' via golang-nuts
On Fri, Mar 17, 2023 at 3:08 PM Chressie Himpel  wrote:
>
> On Fri, Mar 17, 2023 at 1:50 PM Stuart McLean  wrote:
> >
> > I’m not sure where to add os.Stderr.Sync() so I tried in a few spots, 
> > including directly after my call to glog.Error
> >
> > Here’s playground version: https://go.dev/play/p/sHEATjMRhtN
> >
> > It outputs:
> > E1110 23:00:00.00  11 prog.go:26] foo bar
> > captured:
> >
> > When I run the same code with glog v1.0.0 it outputs what we want:
> > captured: E0317 12:27:12.440817   11892 main.go:26] foo bar
>
> Ah thanks. I see the issue. You're setting os.Stderr to a different
> writer to capture the output, but since v1.1.0 we're storing os.Stderr
> at init time in sinks.stderr and hence subsequent logger calls still
> go to stderr instead of the pipe. I think that's worth a fix. I'll
> prepare a fix.

I just tagged a new release
https://github.com/golang/glog/releases/tag/v1.1.1 that should fix
this issue.

>
> > > On 17. Mar 2023, at 11:03, Chressie Himpel  wrote:
> > >
> > > On Fri, Mar 17, 2023 at 10:16 AM Stuart McLean  
> > > wrote:
> > >>
> > >> Thanks so much for the quick answers. I did try setting the 
> > >> `alsologtostderr` flag (and adding `flag.Parse()` after) but it doesn’t 
> > >> make a difference. I’m trying to capture error logs anyway. I’ve tried 
> > >> stepping through the glog code and it looks like messages are being 
> > >> written to a buffer for stderr, but it doesn’t seem like that buffer is 
> > >> being flushed in time for my tests to pick it up. I even tried adding 
> > >> some sleep calls to see if that made a difference, but that didn’t help 
> > >> either. I don’t see any way to flush the stderr buffer manually. It 
> > >> looks like we can only manually flush the file buffer.
> > >
> > > Sure thing. On what OS do you run your tests? The underlying writer of
> > > sinks.stderr is initialized with os.Stderr[0] and writes to it should
> > > typically be unbuffered (on Linux at least). From that perspective
> > > there's nothing really to flush here.
> > >
> > > I suspect that either the sinks.stderr reports Enabled()==false[1]
> > > which would cause the internal/logsink package to skip emitting to it,
> > > or os.Stderr is buffered on your system. In the first case double
> > > check which flags you're passing and that they're effective (and not
> > > overwritten somewhere else), and in the second case you can try to
> > > call os.Stderr.Sync() to force writing to it. If you have a reproducer
> > > i could also take a look.
> > >
> > > [0]: https://github.com/golang/glog/blob/master/glog_file.go#L156
> > > [1]: https://github.com/golang/glog/blob/master/glog_file.go#L178
> > >
> > >>
> > >>> On 16. Mar 2023, at 18:29, Chressie Himpel  wrote:
> > >>>
> > >>> On Thu, Mar 16, 2023 at 5:27 PM Ian Lance Taylor  
> > >>> wrote:
> > 
> >  [ + jba ]
> > 
> >  On Thu, Mar 16, 2023 at 8:56 AM 'Stuart McLean' via golang-nuts
> >   wrote:
> > >
> > > Hi there,
> > >
> > > With glog v1.0.0 I used to be able to easily capture stderr logs for 
> > > in integration tests. With the upgraded version this no longer works. 
> > > I tried various suggestions that I found online and even this 
> > > library: https://github.com/zenizh/go-capturer but nothing seems to 
> > > work.
> > >>>
> > >>> By default glog only prints ERROR level and above to stderr. Did you
> > >>> try to pass the -alsologtostderr flag to your program (or set it via
> > >>> flag.Set("alsologtostderr", "true"))?
> > >>>
> > >
> > > Is there a way to configure glog to write to a specific file that I 
> > > can read from after?
> > >
> > > Thanks for your time,
> > > Stuart McLean
> > >
> > > --
> > > 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/20CCAFD5-6400-4C68-BFBC-AB41F7FA7853%40mac.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/CAOyqgcVMFDOoqW82mwkab-4KYFPZ6H3So6xoKuudRhK%3D49niQw%40mail.gmail.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 

[go-nuts] Re: GLog library can't be used in Golang 1.18 due to "abortProcess redeclared in this block" error

2023-03-22 Thread Juan Antonio Cid Tomás
Understood!

We are upgrading all our projects. Thanks a lot for your time Carla.

On Wednesday, March 22, 2023 at 7:13:14 AM UTC+1 Carla Pfaff wrote:

glog_file_other.go uses the "unix" build constraint, which was introduced 
in Go 1.19: https://tip.golang.org/doc/go1.19#go-unix
Go 1.18 doesn't know about it. Since Go 1.18 is no longer supported (only 
the last two main releases are supported) it's either time to update your 
Go version to 1.19 or 1.20, or you have to stay on an older version of glog.

On Tuesday, 21 March 2023 at 15:40:38 UTC+1 Juan Antonio Cid Tomás wrote:

Hi there,

We have found an error in your library. We have created next test program:

package main

import (
"fmt"

_ "github.com/golang/glog"
)

func main() {
fmt.Println("Hello world")
}

Then we have enforced the usage of the latest changes (master branch), 
instead of the tagged ones:

$  go get -u github.com/golang/glog@master

Having GOOS="linux" in Golang 1.18 we get the next error when trying to 
build ($ go build ./...) the test program:

# github.com/golang/glog
../.asdf/installs/golang/1.18/packages/pkg/mod/
github.com/golang/gl...@v1.1.1-0.20230317133409-c0f9e3d764d3/glog_file_other.go:27:6
 
:
 
abortProcess redeclared in this block
../.asdf/installs/golang/1.18/packages/pkg/mod/
github.com/golang/gl...@v1.1.1-0.20230317133409-c0f9e3d764d3/glog_file_linux.go:33:6
 
:
 
other declaration of abortProcess
 
We don't get this error if we use Golang 1.19. 

We guess this error was caused when you splitted the usage of abortProcess in 
different files 
.
 
If you need more info regarding this don't hesitate to message me.
 

Best regards,

-- 
[image: Logotipo Cabify]Juanan Cid Tomás

Senior Engineer at Middleware
juanant...@cabify.com

[image: Logotipo Somos Neutros en Carbono]


Este mensaje y cualquier archivo adjunto va dirigido exclusivamente a su 
destinatario, pudiendo contener información confidencial sometida a secreto 
profesional. No está permitida su reproducción o distribución sin la 
autorización expresa de Cabify. Si usted no es el destinatario final por 
favor elimínelo e infórmenos por esta vía.

This message and any attached file are intended exclusively for the 
addressee, and it may be confidential. You are not allowed to copy or 
disclose it without Cabify's prior written authorization. If you are not 
the intended recipient please delete it from your system and notify us by 
e-mail.


-- 




Este mensaje y cualquier archivo adjunto va dirigido exclusivamente a 
su destinatario, pudiendo contener información confidencial sometida a 
secreto profesional. No está permitida su reproducción o distribución sin 
la autorización expresa de Cabify. Si usted no es el destinatario final por 
favor elimínelo e infórmenos por esta vía.


This message and any attached 
file are intended exclusively for the addressee, and it may be 
confidential. You are not allowed to copy or disclose it without Cabify's 
prior written authorization. If you are not the intended recipient please 
delete it from your system and notify us by e-mail.

-- 
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/7a9db5f8-7289-4cd2-a0be-b5f3c0187abbn%40googlegroups.com.


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/", 
> http.FileServer(http.Dir("api-swagger"

I think you are missing

http.Handle("/", router)

>   if err := http.ListenAndServe(":8084", nil); err != nil {
> fmt.Println(err)
>   }
> }

...Marvin

-- 
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/ZBrtrVrwEFxt9lH3%40basil.wdw.


Re: [go-nuts] Re: GLog library can't be used in Golang 1.18 due to "abortProcess redeclared in this block" error

2023-03-22 Thread 'Chressie Himpel' via golang-nuts
On Wed, Mar 22, 2023 at 7:13 AM 'Carla Pfaff' via golang-nuts
 wrote:
>
> glog_file_other.go uses the "unix" build constraint, which was introduced in 
> Go 1.19: https://tip.golang.org/doc/go1.19#go-unix
> Go 1.18 doesn't know about it. Since Go 1.18 is no longer supported (only the 
> last two main releases are supported) it's either time to update your Go 
> version to 1.19 or 1.20, or you have to stay on an older version of glog.

Yes, that's correct. I just bumped the version number to require
go1.19 as a minimum (https://github.com/golang/glog/pull/61). Sorry
for the churn.

> On Tuesday, 21 March 2023 at 15:40:38 UTC+1 Juan Antonio Cid Tomás wrote:
>
> Hi there,
>
> We have found an error in your library. We have created next test program:
>
> package main
>
> import (
> "fmt"
>
> _ "github.com/golang/glog"
> )
>
> func main() {
> fmt.Println("Hello world")
> }
>
> Then we have enforced the usage of the latest changes (master branch), 
> instead of the tagged ones:
>
> $  go get -u github.com/golang/glog@master
>
> Having GOOS="linux" in Golang 1.18 we get the next error when trying to build 
> ($ go build ./...) the test program:
>
> # github.com/golang/glog
> ../.asdf/installs/golang/1.18/packages/pkg/mod/github.com/golang/gl...@v1.1.1-0.20230317133409-c0f9e3d764d3/glog_file_other.go:27:6:
>  abortProcess redeclared in this block
> ../.asdf/installs/golang/1.18/packages/pkg/mod/github.com/golang/gl...@v1.1.1-0.20230317133409-c0f9e3d764d3/glog_file_linux.go:33:6:
>  other declaration of abortProcess
>
> We don't get this error if we use Golang 1.19.
>
> We guess this error was caused when you splitted the usage of abortProcess in 
> different files. If you need more info regarding this don't hesitate to 
> message me.
>
>
> Best regards,
>
> --
> Juanan Cid Tomás
>
> Senior Engineer at Middleware
>
> juanant...@cabify.com
>
>
>
> Este mensaje y cualquier archivo adjunto va dirigido exclusivamente a su 
> destinatario, pudiendo contener información confidencial sometida a secreto 
> profesional. No está permitida su reproducción o distribución sin la 
> autorización expresa de Cabify. Si usted no es el destinatario final por 
> favor elimínelo e infórmenos por esta vía.
>
> This message and any attached file are intended exclusively for the 
> addressee, and it may be confidential. You are not allowed to copy or 
> disclose it without Cabify's prior written authorization. If you are not the 
> intended recipient please delete it from your system and notify us by e-mail.
>
> --
> 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/8ae5d05b-1491-4587-b239-6d9267a2a738n%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/CAPgVe6NPm-t7w0P8DuHG%2B5wyTi09fSeazxmj8z_Kma1c7ENOAA%40mail.gmail.com.


[go-nuts] Re: GLog library can't be used in Golang 1.18 due to "abortProcess redeclared in this block" error

2023-03-22 Thread 'Carla Pfaff' via golang-nuts
glog_file_other.go uses the "unix" build constraint, which was introduced 
in Go 1.19: https://tip.golang.org/doc/go1.19#go-unix
Go 1.18 doesn't know about it. Since Go 1.18 is no longer supported (only 
the last two main releases are supported) it's either time to update your 
Go version to 1.19 or 1.20, or you have to stay on an older version of glog.

On Tuesday, 21 March 2023 at 15:40:38 UTC+1 Juan Antonio Cid Tomás wrote:

Hi there,

We have found an error in your library. We have created next test program:

package main

import (
"fmt"

_ "github.com/golang/glog"
)

func main() {
fmt.Println("Hello world")
}

Then we have enforced the usage of the latest changes (master branch), 
instead of the tagged ones:

$  go get -u github.com/golang/glog@master

Having GOOS="linux" in Golang 1.18 we get the next error when trying to 
build ($ go build ./...) the test program:

# github.com/golang/glog
../.asdf/installs/golang/1.18/packages/pkg/mod/
github.com/golang/gl...@v1.1.1-0.20230317133409-c0f9e3d764d3/glog_file_other.go:27:6
 
:
 
abortProcess redeclared in this block
../.asdf/installs/golang/1.18/packages/pkg/mod/
github.com/golang/gl...@v1.1.1-0.20230317133409-c0f9e3d764d3/glog_file_linux.go:33:6
 
:
 
other declaration of abortProcess
 
We don't get this error if we use Golang 1.19. 

We guess this error was caused when you splitted the usage of abortProcess in 
different files 
.
 
If you need more info regarding this don't hesitate to message me.
 

Best regards,

-- 
[image: Logotipo Cabify]Juanan Cid Tomás

Senior Engineer at Middleware
juanant...@cabify.com

[image: Logotipo Somos Neutros en Carbono]


Este mensaje y cualquier archivo adjunto va dirigido exclusivamente a su 
destinatario, pudiendo contener información confidencial sometida a secreto 
profesional. No está permitida su reproducción o distribución sin la 
autorización expresa de Cabify. Si usted no es el destinatario final por 
favor elimínelo e infórmenos por esta vía.

This message and any attached file are intended exclusively for the 
addressee, and it may be confidential. You are not allowed to copy or 
disclose it without Cabify's prior written authorization. If you are not 
the intended recipient please delete it from your system and notify us by 
e-mail.

-- 
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/8ae5d05b-1491-4587-b239-6d9267a2a738n%40googlegroups.com.