[go-nuts] Re: [Contribution] Go_Updater shellscripting (GNU/Linux or WSL)
Hello, the script does that, i created in base of go.dev recommendation, it will not remove the folder, but delete all the content. El martes, 11 de abril de 2023 a la(s) 10:31:45 UTC-4, Brian Candler escribió: > Something to consider: if you untar over an existing installation, then > it's possible you will be left with stale artefacts - e.g. source files > that were in an old version that aren't in the new one. I've been bitten by > this in other projects. > > I haven't been bitten by this in Go, but I always mv or rm the old > /usr/local/go our of the way before untarring a fresh one to avoid the > possibility. > > On Tuesday, 11 April 2023 at 15:00:13 UTC+1 Walddys Emmanuel Dorrejo > Céspedes wrote: > >> hello, i did this Bash Script (only Linux/WSL) to update GoLang, it will >> give you some options, like update to the next patch (1.20.x) or the next >> minor version (1.21) only stable ones (not beta neither rc), if someone >> found useful, here is the link: >> https://gitlab.com/wedc-scripts/go_updater. >> >> it respect the user environment, if Golang home is in other location, it >> will respect that, it will work in base of go env. >> > -- 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/51381f7c-e71a-4c7c-bc8b-7244c71a084en%40googlegroups.com.
[go-nuts] [Contribution] Go_Updater shellscripting (GNU/Linux or WSL)
hello, i did this Bash Script (only Linux/WSL) to update GoLang, it will give you some options, like update to the next patch (1.20.x) or the next minor version (1.21) only stable ones (not beta neither rc), if someone found useful, here is the link: https://gitlab.com/wedc-scripts/go_updater. it respect the user environment, if Golang home is in other location, it will respect that, it will work in base of go env. -- 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/03ef53df-9027-462e-ba13-739a65f37cf1n%40googlegroups.com.
[go-nuts] Re: Go 1.13 Release Candidate 1 is released
Hello Michael, I've posted a reply at https://github.com/golang/go/issues/32326#issuecomment-524997226 but perhaps I'll inline it below: Hello @MichaelTJones, thank you for the patience! We are working on trying to diagnose why it is that by the time that the test executes, that your machine has already created close to 50 threads. To get started, please help me with: a) The output of `sysctl hw` b) Please run this program which will run most of the code from the failing test over a number of *os.Files and creates traces in a zip file. It is available at https://gist.github.com/odeke-em/1f60b09d30675ae9d4db47b3bfa2df22 or inlined ```go package main import ( "archive/zip" "context" "fmt" "io" "io/ioutil" "log" "os" "os/exec" "path/filepath" "time" ) func main() { nPipes := []int{0, 1, 5, 10, 20, 50, 75, 100} tmpDir, err := ioutil.TempDir("", "th") if err != nil { log.Fatalf("Failed to create temporary directory: %v", err) } defer os.RemoveAll(tmpDir) mainGoPath := filepath.Join(tmpDir, "main.go") if err := ioutil.WriteFile(mainGoPath, []byte(sourceCode), 0644); err != nil { log.Printf("writing main file %q: %v", mainGoPath, err) return } for _, n := range nPipes { if err := runIt(tmpDir, mainGoPath, n); err != nil { log.Printf("Error building for %d: %v\n", n, err) } } fz, err := os.Create("contents.zip") if err != nil { log.Printf("Failed to create contents.zip file: %v", err) return } defer fz.Close() zw := zip.NewWriter(fz) defer zw.Close() defer zw.Flush() err = filepath.Walk(tmpDir, func(path string, fi os.FileInfo, err error) error { if fi.IsDir() { return nil } if err != nil { return err } zfh, err := zip.FileInfoHeader(fi) if err != nil { return err } w, err := zw.CreateHeader(zfh) if err != nil { return err } f, err := os.Open(path) if err != nil { return err } defer f.Close() _, err = io.Copy(w, f) return err }) if err != nil { log.Fatalf("filepath.Walk error: %v", err) } } func runIt(baseDir, mainGoPath string, n int) error { // Now run it and save it to the file. ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cmd := exec.CommandContext(ctx, "go", "run", mainGoPath, "-dir", baseDir, "-n", fmt.Sprintf("%d", n)) output, err := cmd.CombinedOutput() if err != nil { err = fmt.Errorf("exec error: %v\nOutput: %s\n", err, output) } return err } const sourceCode = ` package main import ( "flag" "fmt" "log" "os" "path/filepath" "runtime/trace" ) func osPipesIO(n int) { r := make([]*os.File, n) w := make([]*os.File, n) for i := 0; i < n; i++ { rp, wp, err := os.Pipe() if err != nil { for j := 0; j < i; j++ { r[j].Close() w[j].Close() } log.Fatal(err) } r[i] = rp w[i] = wp } creading := make(chan bool, n) cdone := make(chan bool, n) for i := 0; i < n; i++ { go func(i int) { var b [1]byte creading <- true if _, err := r[i].Read(b[:]); err != nil { log.Printf("r[%d].Read: %v", i, err) } if err := r[i].Close(); err != nil { log.Printf("r[%d].Close: %v", i, err) } cdone <- true }(i) } for i := 0; i < n; i++ { <-creading } for i := 0; i < n; i++ { if _, err := w[i].Write([]byte{0}); err != nil { log.Printf("w[%d].Read: %v", i, err) } if err := w[i].Close(); err != nil { log.Printf("w[%d].Close: %v", i, err) } <-cdone } } func main() { baseDir := flag.String("dir", "", "the base directory to place execution traces") n := flag.Int("n", 0, "the number of *os.Pipe to create") flag.Parse() f, err := os.Create(filepath.Join(*baseDir, fmt.Sprintf("trace-%d.txt", *n))) if err != nil { log.Fatalf("Failed to create trace file: %v", err) } defer f.Close() trace.Start(f) defer trace.Stop() osPipesIO(*n) }` ``` c) Please share the created zip file and in there you'll see the various execution traces with n reads from [0, 1, 5, 10, 20, 50, 75, 100] which will perhaps shine a light on what's going on. If you don't feel comfortable sharing c), please feel free to email it to me and if you don't feel comfortable sharing the zip of the execution traces with me, not a problem, just please help me run `go tool trace trace-.txt` after unzipping that file and examining the number of threads created with 0, 1 and 10 os.Pipe IOs. Thank you! On Wednesday, August 21, 2019 at 2:33:06 PM UTC-6, Andrew Bonventre wrote: > > Hello gophers, > > We have just released go1.13rc1, a release candidate version of Go 1.13. > It is cut from release-branch.go1.13 at the revision tagged go1.13rc1. > > Please try your production load tests and unit tests with the new version. > Your help testing these pre-release versions is invaluable. > > Report any problems using the issue tracker: > https://golang.org/issue/new > > If you have Go installed already, the easiest way to try go1.13rc1 > is by using the go command: > $ go get golang.org/dl/go1.13rc1 > $ go1.13rc1 download > > You can download binary and source distributions from the usual place: > https://golang.org/dl/#go1.13rc1 > > To find out what has changed in Go 1.13, read the draft
[go-nuts] ocsql: database/sql wrapper to provide observability with distributed traces and metrics
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.