Re: [go-nuts] Add comparisons to all types

2022-05-05 Thread David Arroyo
On Mon, May 2, 2022, at 22:43, will@gmail.com wrote:
>- Functions: Compare the corresponding memory addresses. The time 
>complexity is constant.

How would this apply to inlined functions? supporting equality would 
essentially force the compiler to keep a the function in the output binary even 
if it's inlined everywhere it's called, just for comparisons. It would also 
complicate 

Here's another example:

type worker struct { ... }
func shutDown() { ... }

func (w *worker) run(orders <-chan func()) {
for f := range orders {
if(f == shutDown) {
log.Printf("got a shutdown command")
w.Cleanup()
}
f()
}
}

currently, Go programs run on a single computer. What if a Go runtime was built 
that ran Go programs across many computers? Or, put another way, what if a 
system architecture emerged where the instruction access time varied so 
drastically across CPU cores that it made sense to duplicate functions across 
cores' fast memory regions, so that the receive operation in the above example 
actually received a duplicate copy of a function? I will admit that closures 
with mutable data segments already complicate such an optimization, but 
function equality would thwart such an optimization altogether.

David

-- 
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/f566007f-aa47-4aaf-bc9e-a0fa9dab1e62%40www.fastmail.com.


Re: [go-nuts] Re: appengine golang logs

2017-11-04 Thread David Arroyo
Sankar,

Have you tried using the Flexible environment? Flex provides a more
"conventional" environment for your programs. There are some
tradeoffs compared with App Engine Standard, but it should be easier
to stay portable.
David

[1]: 
https://cloud.google.com/appengine/docs/flexible/go/writing-application-logs

On Sat, Nov 4, 2017, at 03:26 AM, Sankar P wrote:
> Tried something similar already. 
> 
> context.Background() does not work with the appengine log package and
> panics at runtime. Passing nil also did not work.> 
> Probably initialising the AELogAdapter with a ctx from appengine
> request, in the _ah start handler is the only way. Thanks for
> the idea.> 
> I, for one, though wish that there was a simpler way. 
> 
> 2017-11-04 12:47 GMT+05:30 Gulácsi Tamás :
>> Sth. along https://play.golang.org/p/BwlbkxMLdw ?
>> 
>> Sankar P  ezt írta (időpont: 2017. nov.
>> 4., Szo, 8:10):>>> There is no log.SetWriter in either the builtin log 
>> package or the
>>> appengine log package. There is a log.SetOutput which I mentioned in
>>> my original mail, but I am not able to understand how to connect it
>>> to the appengine logs.>>> 
>>> 2017-11-04 11:44 GMT+05:30 Tamás Gulácsi :
 Use log.SetWriter to divert log calls to appenginelog, if deployed
 there. 
 
 --
  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/XbhcR5eFdno/unsubscribe. 
  To unsubscribe from this group and all its topics, send an email
  to golang-nuts+unsubscr...@googlegroups.com[1].  For more options, 
 visit https://groups.google.com/d/optout.
>>> 
>>> 
>>> 
>>> -- 
>>> Sankar P
>>> http://psankar.blogspot.com
> 
> 
> 
> -- 
> Sankar P
> http://psankar.blogspot.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.>  For more 
> options, visit https://groups.google.com/d/optout.


Links:

  1. mailto:golang-nuts%2bunsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] sanitize filename from post form upload

2017-08-30 Thread David Arroyo
To sanitize a file path you can use https://golang.org/pkg/path/#Clean ,
but you probably want to use https://golang.org/pkg/path/#Base . The
reason is that depending on the browser/client, you may get a path
containing slashes, or you may get just the base filename. So it's
better to just extract the base filename and treat everyone the same.
David

On Wed, Aug 30, 2017, at 10:44 AM, gocss wrote:
> Is there go code to sanitize a filename [or filename(s) if  type=file ... multiple>] when the handler is processing them so as to
> detect things such as ../ that might be buried within them ?> 
> Also is there a way to find out the full pathname?
> 


> --
>  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.

-- 
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: correct/working 9p2000 library in Go?

2017-02-23 Thread David Arroyo
I'm the author of this one[1], and I hate to contribute to the OP's
initial complaint, but it is not complete. I plan to make it as easy
to use as net/http, but I can only find so much time to work on it.
I've also fixed a number of bugs that arose from my misunderstanding
of the protocol, so it would only be compliant by luck right now. I
did use it to write a toy server[2], so it's functional,  but
definitely a moving target.


Regards,

David



[1]: https://aqwari.net/net/styx

[2]: https://github.com/droyo/jsonfs (go get github.com/droyo/jsonfs)



On Thu, Feb 23, 2017, at 11:05 AM, Kare Nuorteva wrote:

> 

> Here's one that I found just recently: https://blog.aqwari.net/9P/

> 

> Cheers,

> Kare


-- 
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] [ANN] styx - create 9P2000 file servers

2016-09-23 Thread David Arroyo
https://aqwari.net/net/styx

It has taken quite a few more weekends than I expected, but I've
produced the styx package and its subpackages as a way to write 9P file
servers, with https://github.com/droyo/jsonfs serving as a demo. I have
tried to take some inspiration from the standard library's net/http
package, without hiding the statefulness of the 9P2000 protocol. It is
still early days; I am still filling in gaps in the tests and
documentation, but this project has been a lot of fun for me and I
wanted to share. Any feedback is appreciated.

- David

-- 
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.