Re: [go-nuts] go vet tool

2019-03-04 Thread Rob Pike
Ah, yes it does work, if not documented in 'go help vet'. Thanks.

-rob


On Tue, Mar 5, 2019 at 10:20 AM Ian Lance Taylor  wrote:

> On Mon, Mar 4, 2019 at 2:00 PM Rob Pike  wrote:
> >
> > The help for go vet does not mention that one can pass individual files,
> only packages.
>
> I'm hardly going to claim that the docs are clear, but most of the go
> commands accept a list of files, which is documented at
> https://golang.org/cmd/go/#hdr-Package_lists_and_patterns if you read
> carefully.
>
> Ian
>
> > On Tue, Mar 5, 2019 at 6:20 AM Ian Lance Taylor  wrote:
> >>
> >> On Sun, Mar 3, 2019 at 11:02 PM  wrote:
> >> >
> >> > Is it possible to use go vet  as go tool vet . With
> go vet it is giving no go source files, to use vet tool every time i have
> to go different paths. Is there any way to use go vet as go tool vet. With
> go tool vet I can be able to see log of all the folders at  a time and no
> need to go each and every folder. Currently, I am using go 1.12 which no
> supporting go tool vet command.
> >>
> >> As the release notes say, `go tool vet` is no longer supported
> >> (https://golang.org/doc/go1.12#vet).  But `go vet` does support
> >> passing file paths, and it does support checking directory trees with
> >> `go vet a/b/...`.
> >>
> >> Ian
> >>
> >> --
> >> 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] how to deal with absent go.mod file in tool package when GO111MODULE=on

2019-03-04 Thread Dan Kortschak
Thanks, though I don't think that will help us for our specific
problem. gobin does not compile for https://github.com/golang/go/commit/65c2069a9f30cb6fa2c512d17dc0ad65
4d621da9





On Mon, 2019-03-04 at 14:13 +, roger peppe wrote:
> It's not a standard tool, but you could use github.com/myitcv/gobin.
> 
> 
> On Sun, 3 Mar 2019 at 20:56, Dan Kortschak  wrote:
> 
> > 
> > As part of our testing we need to install a tool that currently
> > does
> > not have go.mod/go.sum files. Since we test on Go versions both
> > with
> > and without module support and want to test using modules on the
> > versions that have module support we need to use an approach that
> > works
> > in both of those situations. We use git clone and checkout to get
> > the
> > version we want.
> > 
> > However, this fails when GO111MODULE=on because go install wants to
> > find a go.mod and does not. Note that the tool has no external
> > dependencies.
> > 
> > ```
> > $ mkdir -p /home/travis/gopath/src/github.com/goccmack
> > $ git clone https://github.com/goccmack/gocc.git
> > /home/travis/gopath/src/
> > github.com/goccmack/gocc
> > Cloning into '/home/travis/gopath/src/github.com/goccmack/gocc'...
> > $ cd /home/travis/gopath/src/github.com/goccmack/gocc
> > $ git checkout 0e2cfc030005b281b2e5a2de04fa7fe1d5063722
> > Note: checking out '0e2cfc030005b281b2e5a2de04fa7fe1d5063722'.
> > 
> > You are in 'detached HEAD' state. You can look around, make
> > experimental
> > changes and commit them, and you can discard any commits you make
> > in this
> > state without impacting any branches by performing another
> > checkout.
> > 
> > If you want to create a new branch to retain commits you create,
> > you may
> > do so (now or later) by using -b with the checkout command again.
> > Example:
> > 
> >   git checkout -b 
> > 
> > HEAD is now at 0e2cfc0... Merge pull request #78 from
> > shivansh/fix/Makefile
> > $ go install
> > go: cannot find main module, but found .git/config in
> > /home/travis/gopath/src/github.com/goccmack/gocc
> > to create a module there, run:
> > go mod init
> > ```
> > 
> > My approach to dealing with this is to set GO111MODULE=auto for the
> > go
> > install operation, but this is very kludgy and not guaranteed to
> > work
> > if GO111MODULE=auto/off is not respected in the future by one Go
> > version (we support 3 minor versions of Go, so this could
> > potentially
> > happen).
> > 
> > What is the recommended approach for this situation, assuming the
> > tool
> > authors do not want to add a go.mod file?
> > 
> > --
> > 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.


[go-nuts] Project install for go mod

2019-03-04 Thread Liam Breck
What are the recommended from-scratch download/install directions for a
project using go.mod (having 1+ main packages)?

I don't see them in the wiki, sorry.

-- 
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: Can Go 2.x (or later) adopt some concurrency safety paradigms from Rust?

2019-03-04 Thread robert engels
I agree wholeheartedly. Use the race detector, and well designed code - much 
easier to understand and maintain than the equivalent Rust IMO.

> On Mar 4, 2019, at 1:49 PM, Manlio Perillo  wrote:
> 
> On Monday, March 4, 2019 at 8:06:16 PM UTC+1, Jeff Kayser wrote:
> Paradigms of Rust for the Go developer
> https://medium.com/@deckarep/paradigms-of-rust-for-the-go-developer-210f67cd6a29
>  
> 
> 
> I found this article extremely interesting.  Concurrency safety appears to be 
> an area where Rust beats Go.
> 
> 
> Thanks for the article.
> I'm one of the programmers that think Rust is too complex.
> 
> I don't have any intentions to move to Rust.  But it would sure be nice if Go 
> offered the same or similar safety features for concurrency.
> 
> I think Go should offer something like:
> https://doc.rust-lang.org/error-index.html
> 
> > [...]
> 
> Manlio 
> 
> -- 
> 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] go vet tool

2019-03-04 Thread Ian Lance Taylor
On Mon, Mar 4, 2019 at 2:00 PM Rob Pike  wrote:
>
> The help for go vet does not mention that one can pass individual files, only 
> packages.

I'm hardly going to claim that the docs are clear, but most of the go
commands accept a list of files, which is documented at
https://golang.org/cmd/go/#hdr-Package_lists_and_patterns if you read
carefully.

Ian

> On Tue, Mar 5, 2019 at 6:20 AM Ian Lance Taylor  wrote:
>>
>> On Sun, Mar 3, 2019 at 11:02 PM  wrote:
>> >
>> > Is it possible to use go vet  as go tool vet . With go 
>> > vet it is giving no go source files, to use vet tool every time i have to 
>> > go different paths. Is there any way to use go vet as go tool vet. With go 
>> > tool vet I can be able to see log of all the folders at  a time and no 
>> > need to go each and every folder. Currently, I am using go 1.12 which no 
>> > supporting go tool vet command.
>>
>> As the release notes say, `go tool vet` is no longer supported
>> (https://golang.org/doc/go1.12#vet).  But `go vet` does support
>> passing file paths, and it does support checking directory trees with
>> `go vet a/b/...`.
>>
>> Ian
>>
>> --
>> 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] go vet tool

2019-03-04 Thread Rob Pike
The help for go vet does not mention that one can pass individual files,
only packages.

-rob


On Tue, Mar 5, 2019 at 6:20 AM Ian Lance Taylor  wrote:

> On Sun, Mar 3, 2019 at 11:02 PM  wrote:
> >
> > Is it possible to use go vet  as go tool vet . With go
> vet it is giving no go source files, to use vet tool every time i have to
> go different paths. Is there any way to use go vet as go tool vet. With go
> tool vet I can be able to see log of all the folders at  a time and no need
> to go each and every folder. Currently, I am using go 1.12 which no
> supporting go tool vet command.
>
> As the release notes say, `go tool vet` is no longer supported
> (https://golang.org/doc/go1.12#vet).  But `go vet` does support
> passing file paths, and it does support checking directory trees with
> `go vet a/b/...`.
>
> Ian
>
> --
> 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] Allow go mod download to store in subdirectory of current working directory

2019-03-04 Thread thepudds1460
Jorrit,

The simplest solution might be 'go mod vendor' to populate a 'vendor' 
directory, and then set '-mod=vendor' or 'GOFLAGS=-mod=vendor' when 
building.

If that is not workable for some reason, here is an alternative that is 
more similar to your request for a 'go mod download -dir module_cache':

The module download cache location is controlled by GOPATH. In particular, 
'go mod download', 'go build', etc. populate the module cache in 
GOPATH/pkg/mod (or ~/go/pkg/mod if $GOPATH is not set).

In addition, when you want to use a particular module cache, you can tell 
the 'go' command to use a local module cache by setting 
GOPROXY=file:///file/path.

You can put those two things together, which I think gives you the control 
you were asking about:
 
# Populate a module download cache in /tmp/gopath-for-cache
$ GOPATH=/tmp/gopath-for-cache  go mod download

# Build using the contents of the module download cache in 
/tmp/gopath-for-cache
$ GOPROXY=file:///tmp/gopath-for-cache/pkg/mod/cache/download  go build

Note that even though you are setting the GOPROXY environment variable, 
there is no actual proxy process involved, and everything is just being 
read directly from the local filesystem.
 
Here is a more complete "Go Modules by Example" walk-through of that 
technique:

https://github.com/go-modules-by-example/index/tree/master/012_modvendor

Regards,
thepudds

On Monday, March 4, 2019 at 12:50:51 PM UTC-5, Marcin Romaszewicz wrote:
>
> Can you accomplish what you want with module vendoring? Before I set up my 
> own Athens proxy, I was using that to avoid DDOSing github in my build 
> automation, and it seemed to work fine. Your first pipeline step could 
> vendor in all the modules, and subsequent pipeline steps would use those.
>
> -- Marcin
>
>
> On Mon, Mar 4, 2019 at 8:49 AM > wrote:
>
>> I'd like to be able to use go mod download to download packages to 
>> another directory than GOPATH/pkg/mod and automatically have all go 
>> commands be aware of this new location.
>>
>>
>> This is specifically for CI/CD to ensure I can download modules in one 
>> stage and use them in subsequent stages.
>>
>>
>> I'm the author of https://estafette.io/, and just like Bitbucket 
>> Pipelines and Drone.io it executes steps in (public) docker containers, but 
>> the only data passed from stage to stage are the files inside the working 
>> directory. So downloading modules to a directory outside of the 
>> working directory makes them get downloaded again in subsequent stages.
>>
>>
>> NPM tackles this by having the node_modules directory as a local 
>> subdirectory of your repository, but of course this loses you the 
>> performance advantage of having a shared cache for all your repositories.
>>
>>
>> Nuget uses a global cache as well, but they allow you to specify an 
>> alternative location that gets used by their other commands by running 
>> dotnet 
>> restore --packages .nuget/packages.
>>
>>
>> A similar approach as dotnet takes would be best for all go module 
>> related commands to be able to prevent CI/CD from downloading the same 
>> modules multiple times. This could look something like go mod download 
>> -dir module_cache.
>>
>> -- 
>> 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 .
>> 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.


[go-nuts] Re: Go 1.12 installer on Windows 7 (x64) problem

2019-03-04 Thread Tad Vizbaras
Yes, it was Windows 7 SP1 installation issue. Somehow only part of SP1 got 
applied during install. Once fixed Go installed without any issues.

Thanks a lot. 



On Monday, March 4, 2019 at 1:04:16 PM UTC-5, Jake Montgomery wrote:
>
> I have seen posts, unrelated to Go, about installers not recognizing 
> Windows 7 SP1 as being installed. You did a screenshot of the update 
> history, but you should also check that it is listed under 
> Computer->Properties->Windows edition. See here 
> .
>  
>
>
> While it is possible that this is a problem specific to the Go installer, 
> most likely it is not. So I suggest googling for other people with similar 
> issues installing other software.
>
> Good Luck.
>
> On Monday, March 4, 2019 at 11:06:51 AM UTC-5, Tad Vizbaras wrote:
>>
>>
>> Go 1.12 installer on Windows 7 (x64) problem.
>>
>> Requires: Windows 7 with Service Pack 1. 
>> But Service Pack is installed and restart done twice (just to make sure).
>>
>> Screenshot attached.
>>
>> How can I get around installer? Can I force it skip the check?
>>
>>
>>

-- 
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] Naming convention of low-level functions from runtime and everything

2019-03-04 Thread Ian Lance Taylor
On Mon, Mar 4, 2019 at 8:00 AM Michel Levieux  wrote:
>
> I just have a little question here: sometimes reading the low-level code of 
> Go (like runtime, compiler code etc) I find the names of structs and fields 
> quite hard to understand, like acronyms or abreviations or even initials that 
> are not very common, and can't seem to find why it's this way. Can anyone 
> explain this to me or point me to documentation about that? Maybe it has to 
> do with binary sizes of go programs?

It's because the code was originally written in C and was then
transcribed to Go while keeping the names the same.  It doesn't have
anything to do with program binary size (although that is an
interesting thought and may be worth considering).

I don't know of any general docs on the naming.  If you want to ask
about specific abbreviations, feel free to ask here and we will do our
best.

Ian

-- 
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] go vet tool

2019-03-04 Thread Ian Lance Taylor
On Sun, Mar 3, 2019 at 11:02 PM  wrote:
>
> Is it possible to use go vet  as go tool vet . With go vet 
> it is giving no go source files, to use vet tool every time i have to go 
> different paths. Is there any way to use go vet as go tool vet. With go tool 
> vet I can be able to see log of all the folders at  a time and no need to go 
> each and every folder. Currently, I am using go 1.12 which no supporting go 
> tool vet command.

As the release notes say, `go tool vet` is no longer supported
(https://golang.org/doc/go1.12#vet).  But `go vet` does support
passing file paths, and it does support checking directory trees with
`go vet a/b/...`.

Ian

-- 
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] Re: Allow go mod download to store in subdirectory of current working directory

2019-03-04 Thread Manlio Perillo
On Monday, March 4, 2019 at 5:49:06 PM UTC+1, Jorrit Salverda wrote:
>
> I'd like to be able to use go mod download to download packages to 
> another directory than GOPATH/pkg/mod and automatically have all go 
> commands be aware of this new location.
>
>
> This is specifically for CI/CD to ensure I can download modules in one 
> stage and use them in subsequent stages.
>
>
> I'm the author of https://estafette.io/, and just like Bitbucket 
> Pipelines and Drone.io it executes steps in (public) docker containers, but 
> the only data passed from stage to stage are the files inside the working 
> directory. So downloading modules to a directory outside of the 
> working directory makes them get downloaded again in subsequent stages.
>
>
> NPM tackles this by having the node_modules directory as a local 
> subdirectory of your repository, but of course this loses you the 
> performance advantage of having a shared cache for all your repositories.
>

You can set the GOPATH to $PWD/.vendor.  It works with go1.12

I also tried with GOPATH=$PWD, but go does like it:
  $GOPATH/go.mod exists but should not
 
> [...]

Manlio

-- 
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] Can Go 2.x (or later) adopt some concurrency safety paradigms from Rust?

2019-03-04 Thread jeffkayser3
Paradigms of Rust for the Go developer
https://medium.com/@deckarep/paradigms-of-rust-for-the-go-developer-210f67cd6a29

I found this article extremely interesting.  Concurrency safety appears to 
be an area where Rust beats Go.

I don't have any intentions to move to Rust.  But it would sure be nice if 
Go offered the same or similar safety features for concurrency.

Sorry if this turns into a flame.  It seems a worthy discussion topic (to 
me).

~Jeff Kayser

-- 
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] go vet tool

2019-03-04 Thread Rob Pike
I do wish it were still possible to do "go vet file.go" or "go vet
directory" although I do understand why it is not (type checking).

Over time, everything gets better but also worse and always bigger and more
complex.

-rob


On Mon, Mar 4, 2019 at 6:02 PM  wrote:

> Is it possible to use go vet  as go tool vet . With go
> vet it is giving no go source files, to use vet tool every time i have to
> go different paths. Is there any way to use go vet as go tool vet. With go
> tool vet I can be able to see log of all the folders at  a time and no need
> to go each and every folder. Currently, I am using go 1.12 which no
> supporting go tool vet command.
>
> --
> 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.


[go-nuts] Re: Issues with VPN and two different addresses for imports

2019-03-04 Thread Tamás Gulácsi


2019. március 4., hétfő 17:49:29 UTC+1 időpontban Austin LaBerta a 
következőt írta:
>
> Hello,
>
> My particular group in the company I work for uses a lot of copy pasted 
> code (I'm unaware of "why" besides that a lot of these programs are 
> inherited from an older team, no clue why they did that but we've certainly 
> not addressed it); I've been pushing for increasing our code reuse because 
> copy pasting code everywhere makes our job much harder in the long run with 
> support. People seem like they're on board once we get a moment out of our 
> sprint to actually go and refine old code; but one problem I'm reaching is 
> that our private git repos have different urls in our dev and production 
> environment. E.g. dependency 
> "bitbucket.companypublic-vpn.site/our/package/here" and 
> "bitbucket.inside-company-private.network/our/package/here"; I've been 
> exploring make and using 'sed' to replace text in the code but I wanted to 
> know if there was a simpler and less ugly way. Something preferable without 
> modifying the entire company build architecture since that would be slow 
> and relies on other teams in the company to care about my plight. 
>
> Thank you,
> Austin
>
>
>
go fmt -w -r '"ugly" -> "nice"'
is better than sed.

For the real solution: use one canonical name (say company.com) and put 
"special" meta info into that html code.

   see the source at https://unosoft.hu/aodb for example - the essentials is
< meta name="go-import" content="unosoft.hu/aodb git 
ssh://git@git.unosoft.local/tgulacsi/aodb.git" >


Tamás Gulácsi

-- 
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] Re: Go 1.12 installer on Windows 7 (x64) problem

2019-03-04 Thread jake6502
I have seen posts, unrelated to Go, about installers not recognizing 
Windows 7 SP1 as being installed. You did a screenshot of the update 
history, but you should also check that it is listed under 
Computer->Properties->Windows edition. See here 
.
 


While it is possible that this is a problem specific to the Go installer, 
most likely it is not. So I suggest googling for other people with similar 
issues installing other software.

Good Luck.

On Monday, March 4, 2019 at 11:06:51 AM UTC-5, Tad Vizbaras wrote:
>
>
> Go 1.12 installer on Windows 7 (x64) problem.
>
> Requires: Windows 7 with Service Pack 1. 
> But Service Pack is installed and restart done twice (just to make sure).
>
> Screenshot attached.
>
> How can I get around installer? Can I force it skip the check?
>
>
>

-- 
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] ocsql: database/sql wrapper to provide observability with distributed traces and metrics

2019-03-04 Thread emmanuel
Hello everyone,
   I am delighted to announce observability tools to help provide 
distributed tracing and metrics for your SQL drivers in Go.

*"contrib.go.opencensus/integrations/ocsql"* is an instrumented wrapper for 
*"database/sql"*, using OpenCensus https://opencensus.io/

It can be trivially added to your apps with either of these 2 methods:
1. By registration:

package main
import (
"database/sql"
"log"

"contrib.go.opencensus.io/integrations/ocsql")
func main() {
var ordinaryDriverName string // For example "mysql", "sqlite3" etc.
// First step is to register the driver and // then reuse that driver name 
while invoking sql.Open  driverName, err := ocsql.Register(ordinaryDriverName)
if err != nil {
log.Fatalf("Failed to register the ocsql driver: %v", err)
}
db, err := sql.Open(driverName, "resource.db")
if err != nil {
log.Fatalf("Failed to open the SQL database: %v", err)
}
defer db.Close()}


2.  By explicitly wrapping

package mainimport (
"log"
"database/sql"

sqlite3 "github.com/mattn/go-sqlite3"
"contrib.go.opencensus.io/integrations/ocsql"}
const driverName = "ocsql"
func main() {
// wrap ocsql around existing database driver   driver := 
ocsql.Wrap({})

// register our ocsql wrapped driver with database/sql  
sql.Register(driverName, driver)

// use our ocsql driver db, err := sql.Open(driverName, "my-sqlite.db")
if err != nil {
log.Fatalf("Failed to open the SQL database: %v", err)
}
defer db.Close()

}


For an end-to-end guide, please take a look 
at https://opencensus.io/integrations/sql/go_sql/#end-to-end-example
which when run will extract traces and metrics.

Couple that with say:
* ochttp https://opencensus.io/guides/http/go/net_http/
* ocgrpc https://opencensus.io/guides/grpc/go/

and your applications/micro-services will be lit up with observability, 
with minimal effort. I encourage you to check it out.
A bonus to tack on simplicity and reduce the hassle of deployment would be 
to use the *OpenCensus Agent* https://opencensus.io/agent/

You are all cordially welcome to the OpenCensus project and community 
https://opencensus.io/community/,
but also it would be great to get your feedback so please don't hesitate to 
reach out. 

Thank you for your time, attention and kind consideration.
Kind regards,
Emmanuel Odeke
Orijtech, Inc.

*PS:*
*A word about OpenCensus:*
The OpenCensus project https://opencensus.io provides a vendor-agnostic and 
single distribution of libraries for observability with distributed tracing 
and metrics.
It is the open source rewrite of the observability tools that have powered 
Google's production systems for the past 10+ years. The project's libraries 
are available in
a variety of languages like Go, C#, Java, Python, C++, Erlang/Elixir, PHP, 
Node.js and Ruby. It allows you to collect observability signals once and 
export to a plethora
of backends such as AWS X-Ray, Google Stackdriver, Honeycomb, Microsoft 
Azure Monitor, DataDog, Prometheus, Zipkin, Jaeger, Instana and many more.

-- 
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] Allow go mod download to store in subdirectory of current working directory

2019-03-04 Thread Marcin Romaszewicz
Can you accomplish what you want with module vendoring? Before I set up my
own Athens proxy, I was using that to avoid DDOSing github in my build
automation, and it seemed to work fine. Your first pipeline step could
vendor in all the modules, and subsequent pipeline steps would use those.

-- Marcin


On Mon, Mar 4, 2019 at 8:49 AM  wrote:

> I'd like to be able to use go mod download to download packages to
> another directory than GOPATH/pkg/mod and automatically have all go
> commands be aware of this new location.
>
>
> This is specifically for CI/CD to ensure I can download modules in one
> stage and use them in subsequent stages.
>
>
> I'm the author of https://estafette.io/, and just like Bitbucket
> Pipelines and Drone.io it executes steps in (public) docker containers, but
> the only data passed from stage to stage are the files inside the working
> directory. So downloading modules to a directory outside of the
> working directory makes them get downloaded again in subsequent stages.
>
>
> NPM tackles this by having the node_modules directory as a local
> subdirectory of your repository, but of course this loses you the
> performance advantage of having a shared cache for all your repositories.
>
>
> Nuget uses a global cache as well, but they allow you to specify an
> alternative location that gets used by their other commands by running dotnet
> restore --packages .nuget/packages.
>
>
> A similar approach as dotnet takes would be best for all go module related
> commands to be able to prevent CI/CD from downloading the same modules
> multiple times. This could look something like go mod download -dir
> module_cache.
>
> --
> 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] Different Languages of a Program Project

2019-03-04 Thread Chris Burkert
John, the Web Browser communicates with the Web Server using the http
protocol. So http is the definition how they interact with each other. It’s
not a language but a protocol.

The Web Browser can display (or render) stuff which has been transferred
via http. This could be some HTML with the help of JavaScript. HTML is a
markup language and you cannot program with it. It is comprises the parts
your web page is made of e.g. a table. JavaScript on the other hand is a
language one can program with (e.g. the animations you mention). A third
thing is CSS used to position or colorize HTML elements like a table.

The Web Server of course should be the one from Go :) But there are many
around. The simplest way is to serve a directory which contains HTML, CSS
and JavaScript files. It becomes interesting when your Web Server creates
dynamic HTML using some logic. This can become complicated when you have a
database or services which your Go code connects to. Then things like sql,
rest, grpc or soap come into the game. But that might be too much for the
moment.

Hope this helps.

John  schrieb am Mo. 4. März 2019 um 02:07:

> I have come to a realization about programming and the different roles of
> each language in a project. Here below are what I thought, and hope that I
> may receive confirmation from my fellow programmers. Thank you.
>
> Golang: Main Project Management
> HTML: Website Formatting
> Javascript: Creating Animations etc.
> HTTP: Web Page Management
>
> --
> 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.


[go-nuts] [ANN] A 2D game library Ebiten 1.9.0 - No Cgo on Windows, Metal on macOS, etc.

2019-03-04 Thread Hajime Hoshi
Hi all,

I'm happy to announce the new version of *Ebiten 1.9.0*!

Ebiten is a dead simple 2D game library, with which you can develop 2D
games working on multiple environments including desktops, browsers and
mobiles.

GitHub project: https://github.com/hajimehoshi/ebiten
1.9.0 Detail: https://github.com/hajimehoshi/ebiten/releases/tag/v1.9.0
Website: https://hajimehoshi.github.io/ebiten/

New features in 1.9.0:

 * *No Cgo on Windows!*
   * You can build and run Ebiten games without C compilers on Windows!
 * Metal on macOS
   * Now Ebiten uses Metal instead of OpenGL on macOS.
 * Performance improvement

Enjoy!

-- 
Hajime Hoshi 

-- 
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] how to deal with absent go.mod file in tool package when GO111MODULE=on

2019-03-04 Thread roger peppe
It's not a standard tool, but you could use github.com/myitcv/gobin.


On Sun, 3 Mar 2019 at 20:56, Dan Kortschak  wrote:

> As part of our testing we need to install a tool that currently does
> not have go.mod/go.sum files. Since we test on Go versions both with
> and without module support and want to test using modules on the
> versions that have module support we need to use an approach that works
> in both of those situations. We use git clone and checkout to get the
> version we want.
>
> However, this fails when GO111MODULE=on because go install wants to
> find a go.mod and does not. Note that the tool has no external
> dependencies.
>
> ```
> $ mkdir -p /home/travis/gopath/src/github.com/goccmack
> $ git clone https://github.com/goccmack/gocc.git /home/travis/gopath/src/
> github.com/goccmack/gocc
> Cloning into '/home/travis/gopath/src/github.com/goccmack/gocc'...
> $ cd /home/travis/gopath/src/github.com/goccmack/gocc
> $ git checkout 0e2cfc030005b281b2e5a2de04fa7fe1d5063722
> Note: checking out '0e2cfc030005b281b2e5a2de04fa7fe1d5063722'.
>
> You are in 'detached HEAD' state. You can look around, make experimental
> changes and commit them, and you can discard any commits you make in this
> state without impacting any branches by performing another checkout.
>
> If you want to create a new branch to retain commits you create, you may
> do so (now or later) by using -b with the checkout command again. Example:
>
>   git checkout -b 
>
> HEAD is now at 0e2cfc0... Merge pull request #78 from shivansh/fix/Makefile
> $ go install
> go: cannot find main module, but found .git/config in
> /home/travis/gopath/src/github.com/goccmack/gocc
> to create a module there, run:
> go mod init
> ```
>
> My approach to dealing with this is to set GO111MODULE=auto for the go
> install operation, but this is very kludgy and not guaranteed to work
> if GO111MODULE=auto/off is not respected in the future by one Go
> version (we support 3 minor versions of Go, so this could potentially
> happen).
>
> What is the recommended approach for this situation, assuming the tool
> authors do not want to add a go.mod file?
>
> --
> 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.