Re: [go-nuts] Idea for a language addition for error handling: inject/eject

2022-11-11 Thread Mike Schinkel
Hi G.,

It takes guts to make a proposal in the Go community. Kudos for doing so.

However,  the issue with this proposal for me is the issue I have with 
almost(?) every other proposal to handle errors in Go differently from what 
Go currently allows. They all make the assumption that as soon as an error 
occurs the *only thing* I would want to do is an immediate return, which I 
*almost 
never* do. 

Instead I almost always annotate errors with context to help when debugging 
logs, and often do some analysis to potentially resolve the error — such as 
a retry, or ignoring when not relevant — and the current structure of Go 
error handling, while I am sure it could be improved somehow, currently 
works extremely well for this.

Also, I don't really like the idea of having to create a different function 
located a distance away in terms of code location from where the error 
occurs in order to be able to handle an error.  I much better how Go 
optimizes my ability to address an error exactly at the point in which I 
recognize that an error occurred.

As an aside, I would rather see Go make it easier to annotate errors with 
context in a way that does not require so much duplication of effort 
throughout the code than make it easier to just return early.

So from a concerned-for-my-own-interests perspective if something that 
makes it easier to do an immediate return on `err!=nil` were added to Go 
and it were to be used ubiquitously it would make it much harder to me to 
stick with Go moving forward. #fwiw

-Mike

On Wednesday, November 9, 2022 at 4:42:55 PM UTC-5 paurea wrote:

> On Wed, Nov 9, 2022, 20:47 Ian Lance Taylor  wrote:
>
>> On Wed, Nov 9, 2022 at 10:40 AM Gorka Guardiola  wrote:
>>
>> Seems related to https://go.dev/issue/54361, although due to inject it
>> is not the same.
>>
>
> I hadn't seen that proposal.
>
>>
> It is similar in the sense that it is a more powerful return, but this is 
> much more limited and restricted (1 call level explicitly annotated in the 
> function call vs. returning N levels to a label/function name). In that 
> sense it is a subset of what can be done with that change but more 
> structured. I feel it could be easier to reason about.
>
> The changes to the language, runtime, compiler... are also quite more 
> limited. The bad part is the need for two new reserved words.
>
> G.
>
>
>

-- 
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/de56e687-9db7-476c-b042-eade94d4f00fn%40googlegroups.com.


Re: [go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread Sandeep Kalra
Thanks, sorted out.

this works!
 //go:build debug || linux_debug || darwin_debug || darwin
 // +build debug linux_debug darwin_debug darwin

On Friday, November 11, 2022 at 3:50:23 PM UTC-6 harr...@spu.edu wrote:

> I think the result of the proposal explains some rewriting in .go files, 
> at least.
>
> I believe the conventional wisdom/best practices here are:
>
> - Use separate, parallel files to hold platform- (or tag-) specific code, 
> e.g:
> init_darwin.go, init_linux.go, init_windows.go
>
> - Prefer setting environment variables GOOS, GOARCH to passing build tag 
> arguments
> 
> I think these quick guides are up-to-date:
>
> https://www.digitalocean.com/community/tutorials/building-go-applications-for-different-operating-systems-and-architectures
>
> https://www.digitalocean.com/community/tutorials/customizing-go-binaries-with-build-tags
>
> I hope this helps, I'm not convinced I'm not missing something :)
> On Friday, November 11, 2022 at 1:27:22 PM UTC-8 sandee...@gmail.com 
> wrote:
>
>> probably yes - the implementation of tools for this feature. 
>>
>> If you see the accepted proposal there is this example:
>> https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md
>> // +build 386 windows,amd64 windows
>>
>> BTW, I am on go1.19.3.
>>
>> On Friday, November 11, 2022 at 3:18:44 PM UTC-6 harr...@spu.edu wrote:
>>
>>> Is this relevant? https://github.com/golang/go/issues/41184
>>>
>>> On Friday, November 11, 2022 at 1:16:02 PM UTC-8 se...@liao.dev wrote:
>>>
 You'll need to provide more info if you want to report a bug:

 ```
 main » cat main.go 
 // +build production
 // +build linux

 package main

 21:13:35 ~/tmp/testrepo0017 0:00:00
 main » go fmt .
 main.go

 21:13:39 ~/tmp/testrepo0017 0:00:00
 main » cat main.go
 //go:build production && linux
 // +build production,linux

 package main
 ```
 - sean


 On Fri, Nov 11, 2022 at 9:13 PM Sandeep Kalra  
 wrote:

> and similar issue with other style of adding tags as well
>
> i.e. 
> // +build tag1,tag2
> // +build tag1 tag2
> etc
>
> On Friday, November 11, 2022 at 3:07:40 PM UTC-6 Sandeep Kalra wrote:
>
>> Original code:
>>
>> $ cat production.go
>>
>> //go:build production
>> // +build production
>> // +build linux  << Notice This Line as my production code is 
>> only available on Linux
>>
>> package main
>>
>> const (
>> isProductionCode = true
>> isDebugCode  = false
>> )
>>
>> $ go fmt production.go
>> production.go
>> $ cat production.go
>> //go:build production
>> // +build production
>>
>> package main
>>
>> const (
>> isProductionCode = true
>> isDebugCode  = false
>> )
>> Thanks,
>> Sandeep Kalra
>>
> -- 
> 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/9a4b4e5d-4c3f-469d-8cc5-6a268152cd5an%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/6c202543-0a3f-4872-abda-d0dcd139f780n%40googlegroups.com.


Re: [go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread Andrew Harris
I think the result of the proposal explains some rewriting in .go files, at 
least.

I believe the conventional wisdom/best practices here are:

- Use separate, parallel files to hold platform- (or tag-) specific code, 
e.g:
init_darwin.go, init_linux.go, init_windows.go

- Prefer setting environment variables GOOS, GOARCH to passing build tag 
arguments

I think these quick guides are up-to-date:
https://www.digitalocean.com/community/tutorials/building-go-applications-for-different-operating-systems-and-architectures
https://www.digitalocean.com/community/tutorials/customizing-go-binaries-with-build-tags

I hope this helps, I'm not convinced I'm not missing something :)
On Friday, November 11, 2022 at 1:27:22 PM UTC-8 sandee...@gmail.com wrote:

> probably yes - the implementation of tools for this feature. 
>
> If you see the accepted proposal there is this example:
> https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md
> // +build 386 windows,amd64 windows
>
> BTW, I am on go1.19.3.
>
> On Friday, November 11, 2022 at 3:18:44 PM UTC-6 harr...@spu.edu wrote:
>
>> Is this relevant? https://github.com/golang/go/issues/41184
>>
>> On Friday, November 11, 2022 at 1:16:02 PM UTC-8 se...@liao.dev wrote:
>>
>>> You'll need to provide more info if you want to report a bug:
>>>
>>> ```
>>> main » cat main.go 
>>> // +build production
>>> // +build linux
>>>
>>> package main
>>>
>>> 21:13:35 ~/tmp/testrepo0017 0:00:00
>>> main » go fmt .
>>> main.go
>>>
>>> 21:13:39 ~/tmp/testrepo0017 0:00:00
>>> main » cat main.go
>>> //go:build production && linux
>>> // +build production,linux
>>>
>>> package main
>>> ```
>>> - sean
>>>
>>>
>>> On Fri, Nov 11, 2022 at 9:13 PM Sandeep Kalra  
>>> wrote:
>>>
 and similar issue with other style of adding tags as well

 i.e. 
 // +build tag1,tag2
 // +build tag1 tag2
 etc

 On Friday, November 11, 2022 at 3:07:40 PM UTC-6 Sandeep Kalra wrote:

> Original code:
>
> $ cat production.go
>
> //go:build production
> // +build production
> // +build linux  << Notice This Line as my production code is only 
> available on Linux
>
> package main
>
> const (
> isProductionCode = true
> isDebugCode  = false
> )
>
> $ go fmt production.go
> production.go
> $ cat production.go
> //go:build production
> // +build production
>
> package main
>
> const (
> isProductionCode = true
> isDebugCode  = false
> )
> Thanks,
> Sandeep Kalra
>
 -- 
 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/9a4b4e5d-4c3f-469d-8cc5-6a268152cd5an%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/d9dde962-34f1-413b-bd5d-43798bd5516dn%40googlegroups.com.


Re: [go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread Sandeep Kalra
probably yes - the implementation of tools for this feature. 

If you see the accepted proposal there is this example:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md
// +build 386 windows,amd64 windows

BTW, I am on go1.19.3.

On Friday, November 11, 2022 at 3:18:44 PM UTC-6 harr...@spu.edu wrote:

> Is this relevant? https://github.com/golang/go/issues/41184
>
> On Friday, November 11, 2022 at 1:16:02 PM UTC-8 se...@liao.dev wrote:
>
>> You'll need to provide more info if you want to report a bug:
>>
>> ```
>> main » cat main.go 
>> // +build production
>> // +build linux
>>
>> package main
>>
>> 21:13:35 ~/tmp/testrepo0017 0:00:00
>> main » go fmt .
>> main.go
>>
>> 21:13:39 ~/tmp/testrepo0017 0:00:00
>> main » cat main.go
>> //go:build production && linux
>> // +build production,linux
>>
>> package main
>> ```
>> - sean
>>
>>
>> On Fri, Nov 11, 2022 at 9:13 PM Sandeep Kalra  
>> wrote:
>>
>>> and similar issue with other style of adding tags as well
>>>
>>> i.e. 
>>> // +build tag1,tag2
>>> // +build tag1 tag2
>>> etc
>>>
>>> On Friday, November 11, 2022 at 3:07:40 PM UTC-6 Sandeep Kalra wrote:
>>>
 Original code:

 $ cat production.go

 //go:build production
 // +build production
 // +build linux  << Notice This Line as my production code is only 
 available on Linux

 package main

 const (
 isProductionCode = true
 isDebugCode  = false
 )

 $ go fmt production.go
 production.go
 $ cat production.go
 //go:build production
 // +build production

 package main

 const (
 isProductionCode = true
 isDebugCode  = false
 )
 Thanks,
 Sandeep Kalra

>>> -- 
>>> 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/9a4b4e5d-4c3f-469d-8cc5-6a268152cd5an%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/cb1f8f48-39c0-4b41-b3d3-4ee50e0dbf6cn%40googlegroups.com.


Re: [go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread Sandeep Kalra
Hi, I will try to explain:
so, I have to run my code at 3 places : linux, windows and darwin. and On 
each platform there is a production and debug code.
To make this happen, i am using build tags. 
for e.g. to make build for linux in production, the script will use this:
go build --tags "linux, production"  

This is good on build side of things, but not at the go code side. As soon 
as I send to build process, we do fmt, lint etc, the "go fmt" removes the 
2nd tag and then the symbols in go file is not found. 
Best Regards,
Sandeep
On Friday, November 11, 2022 at 3:16:02 PM UTC-6 se...@liao.dev wrote:

> You'll need to provide more info if you want to report a bug:
>
> ```
> main » cat main.go 
> // +build production
> // +build linux
>
> package main
>
> 21:13:35 ~/tmp/testrepo0017 0:00:00
> main » go fmt .
> main.go
>
> 21:13:39 ~/tmp/testrepo0017 0:00:00
> main » cat main.go
> //go:build production && linux
> // +build production,linux
>
> package main
> ```
> - sean
>
>
> On Fri, Nov 11, 2022 at 9:13 PM Sandeep Kalra  wrote:
>
>> and similar issue with other style of adding tags as well
>>
>> i.e. 
>> // +build tag1,tag2
>> // +build tag1 tag2
>> etc
>>
>> On Friday, November 11, 2022 at 3:07:40 PM UTC-6 Sandeep Kalra wrote:
>>
>>> Original code:
>>>
>>> $ cat production.go
>>>
>>> //go:build production
>>> // +build production
>>> // +build linux  << Notice This Line as my production code is only 
>>> available on Linux
>>>
>>> package main
>>>
>>> const (
>>> isProductionCode = true
>>> isDebugCode  = false
>>> )
>>>
>>> $ go fmt production.go
>>> production.go
>>> $ cat production.go
>>> //go:build production
>>> // +build production
>>>
>>> package main
>>>
>>> const (
>>> isProductionCode = true
>>> isDebugCode  = false
>>> )
>>> Thanks,
>>> Sandeep Kalra
>>>
>> -- 
>> 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/9a4b4e5d-4c3f-469d-8cc5-6a268152cd5an%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/eac08e40-ec84-47b3-a54f-a305c6aedb04n%40googlegroups.com.


Re: [go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread Andrew Harris
Is this relevant? https://github.com/golang/go/issues/41184

On Friday, November 11, 2022 at 1:16:02 PM UTC-8 se...@liao.dev wrote:

> You'll need to provide more info if you want to report a bug:
>
> ```
> main » cat main.go 
> // +build production
> // +build linux
>
> package main
>
> 21:13:35 ~/tmp/testrepo0017 0:00:00
> main » go fmt .
> main.go
>
> 21:13:39 ~/tmp/testrepo0017 0:00:00
> main » cat main.go
> //go:build production && linux
> // +build production,linux
>
> package main
> ```
> - sean
>
>
> On Fri, Nov 11, 2022 at 9:13 PM Sandeep Kalra  wrote:
>
>> and similar issue with other style of adding tags as well
>>
>> i.e. 
>> // +build tag1,tag2
>> // +build tag1 tag2
>> etc
>>
>> On Friday, November 11, 2022 at 3:07:40 PM UTC-6 Sandeep Kalra wrote:
>>
>>> Original code:
>>>
>>> $ cat production.go
>>>
>>> //go:build production
>>> // +build production
>>> // +build linux  << Notice This Line as my production code is only 
>>> available on Linux
>>>
>>> package main
>>>
>>> const (
>>> isProductionCode = true
>>> isDebugCode  = false
>>> )
>>>
>>> $ go fmt production.go
>>> production.go
>>> $ cat production.go
>>> //go:build production
>>> // +build production
>>>
>>> package main
>>>
>>> const (
>>> isProductionCode = true
>>> isDebugCode  = false
>>> )
>>> Thanks,
>>> Sandeep Kalra
>>>
>> -- 
>> 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/9a4b4e5d-4c3f-469d-8cc5-6a268152cd5an%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/41042213-36b9-47d5-934f-8457a16a956cn%40googlegroups.com.


Re: [go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread 'Sean Liao' via golang-nuts
You'll need to provide more info if you want to report a bug:

```
main » cat main.go
// +build production
// +build linux

package main

21:13:35 ~/tmp/testrepo0017 0:00:00
main » go fmt .
main.go

21:13:39 ~/tmp/testrepo0017 0:00:00
main » cat main.go
//go:build production && linux
// +build production,linux

package main
```
- sean


On Fri, Nov 11, 2022 at 9:13 PM Sandeep Kalra 
wrote:

> and similar issue with other style of adding tags as well
>
> i.e.
> // +build tag1,tag2
> // +build tag1 tag2
> etc
>
> On Friday, November 11, 2022 at 3:07:40 PM UTC-6 Sandeep Kalra wrote:
>
>> Original code:
>>
>> $ cat production.go
>>
>> //go:build production
>> // +build production
>> // +build linux  << Notice This Line as my production code is only
>> available on Linux
>>
>> package main
>>
>> const (
>> isProductionCode = true
>> isDebugCode  = false
>> )
>>
>> $ go fmt production.go
>> production.go
>> $ cat production.go
>> //go:build production
>> // +build production
>>
>> package main
>>
>> const (
>> isProductionCode = true
>> isDebugCode  = false
>> )
>> Thanks,
>> Sandeep Kalra
>>
> --
> 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/9a4b4e5d-4c3f-469d-8cc5-6a268152cd5an%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/CAGabyPo71tHJcW3u%3DOrpmsaED4%2BZAfr9a80xz9DWSQSyK5C1%2Bg%40mail.gmail.com.


[go-nuts] Re: is this a bug in "go fmt"?

2022-11-11 Thread Sandeep Kalra
and similar issue with other style of adding tags as well

i.e. 
// +build tag1,tag2
// +build tag1 tag2
etc

On Friday, November 11, 2022 at 3:07:40 PM UTC-6 Sandeep Kalra wrote:

> Original code:
>
> $ cat production.go
>
> //go:build production
> // +build production
> // +build linux  << Notice This Line as my production code is only 
> available on Linux
>
> package main
>
> const (
> isProductionCode = true
> isDebugCode  = false
> )
>
> $ go fmt production.go
> production.go
> $ cat production.go
> //go:build production
> // +build production
>
> package main
>
> const (
> isProductionCode = true
> isDebugCode  = false
> )
> Thanks,
> Sandeep Kalra
>

-- 
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/9a4b4e5d-4c3f-469d-8cc5-6a268152cd5an%40googlegroups.com.


[go-nuts] is this a bug in "go fmt"?

2022-11-11 Thread Sandeep Kalra
Original code:

$ cat production.go

//go:build production
// +build production
// +build linux  << Notice This Line as my production code is only 
available on Linux

package main

const (
isProductionCode = true
isDebugCode  = false
)

$ go fmt production.go
production.go
$ cat production.go
//go:build production
// +build production

package main

const (
isProductionCode = true
isDebugCode  = false
)
Thanks,
Sandeep Kalra

-- 
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/450aff24-c13d-4a16-a360-93cfeaa21578n%40googlegroups.com.


[go-nuts] go get with Azure Devops on premise?

2022-11-11 Thread Johann Höchtl
Hi,

we are using Azure Devops server
Version Azure DevOps Server 2020 Update 1.1
on premise.

The server is not accessible from the internet.
The web server uses integrated authentication for access.

Browsing a git repository from a web browser looks like this:
https://servername.yada.yada/tfs/CompanyCollection/_git/aconcreteProject

I can successfully use git with ssh enabled. For the above aconcreteProject
git remote -v says:

origin
 ssh://servername.yada.yada:22/tfs/CompanyCollection/aconcreteProject/_git/
aconcreteProject   (fetch)

push and fetch work without issues.

When I run

go install
servername.yada.yada/tfs/CompanyCollection/_git/aconcreteProject@latest

it responds with

go: servername.yada.yada/tfs/CompanyCollection/_git/aconcreteProject@latest:
unrecognized import path "
servername.yada.yada/tfs/CompanyCollection/_git/aconcreteProject  ":
reading
https://servername.yada.yada/tfs/CompanyCollection/_git/aconcreteProject?go-get=1:
401 Unauthorized

I have not yet setup environment variable GOPRIVATE
I have not yet setup insteadOf in .gitignore (to actually use ssh instead
of https)

Will I be able to use Devops Server 2020 Update 1.1 to go get / go install
packages?
What do I have to set GOPRIVATE to, if my intention is to finally arrive at
an import prefix of
servername.yada.yada//tfs/CompanyCollection/aconcreteProject
(do I have to hint go get to use git and append .git?)

Thanks!

-- 
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/CAH4isRwzKhBHiwCA965TdcgzfQDgkp%2BEc5RpANiwQdk4OiR5EA%40mail.gmail.com.


[go-nuts] BUGFIX-66: Algorithmic Puzzles in Go

2022-11-11 Thread BUGFIX 66
Still under construction: https://BUGFIX-66.com

Site is intended to be like the book Hacker's Delight, but as a game.

Or like professional programming, where you're mostly trying to 
understand/modify other people's code.

Or like programming in a post-GPT3 world where you're checking/fixing a 
transformer language model's plagiarized/regurgitated code. Our dystopian 
future.

The site builds and runs your code. If your code doesn't compile or doesn't 
compute the correct function, the code is rejected.

Each puzzle is a little program. Look at the example here:

https://bugfix-66.com/contribute

The code you edit on the website is under "// EDIT". Any code you put into 
the web form is compiled and run on the server.

I'm relying on the fact that the Go language allows imports only at the 
start of the program text (immediately following the package statement).

package xxx
import yyy
<... testing functions, etc., that I control ...>


Basically, the user can never write an import statement, and that's enough.

Go doesn't allow inline assembly, so direct syscalls are impossible. All 
memory accesses are bounds checked.

The code is built and executed with resource limits on memory and CPU time.

If you can think of a way the server could be compromised, I'm VERY 
interested to hear it. 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/fd676e28-3639-4fc8-a7b4-3288e08fdd3en%40googlegroups.com.


[go-nuts] NSA recommends using memory safe languages like Go

2022-11-11 Thread peterGo
FYI

The US National Security Agency (NSA) published guidance today to help 
software developers and operators prevent and mitigate software memory 
safety issues, which account for a large portion of exploitable 
vulnerabilities.

https://www.nsa.gov/Press-Room/News-Highlights/Article/Article/3215760/nsa-releases-guidance-on-how-to-protect-against-software-memory-safety-issues/

National Security Agency | Cybersecurity Information Sheet
Software Memory Safety

https://media.defense.gov/2022/Nov/10/2003112742/-1/-1/0/CSI_SOFTWARE_MEMORY_SAFETY.PDF

Memory safe languages

Using a memory safe language can help prevent programmers from introducing 
certain
types of memory-related issues. Memory is managed automatically as part of 
the
computer language; it does not rely on the programmer adding code to 
implement
memory protections. The language institutes automatic protections using a 
combination
of compile time and runtime checks. These inherent language features 
protect the
programmer from introducing memory management mistakes unintentionally. 
Examples
of memory safe language include C#, Go, Java®, Ruby™, Rust®, and Swift®. 

peter

-- 
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/7d7c8c81-014d-44c6-9f84-19ed288c3e34n%40googlegroups.com.