System: Debian/Ubuntu/Fedora. Might work for others as well.
As mentioned here, to update a go version you will first need to uninstall the original version.
To uninstall, delete the /usr/local/go directory by:
| # cat << EOF > /dev/null | |
| # https://github.com/gpakosz/.tmux | |
| # (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license, | |
| # without any warranty. | |
| # Copyright 2012— Gregory Pakosz (@gpakosz). | |
| # /!\ do not edit this file | |
| # instead, override settings in ~/.tmux.conf.local, see README.md | |
| # -- general ------------------------------------------------------------------- |
| sudo su - postgres | |
| # Backup Database | |
| pg_dump --host localhost --user postgres --dbname=db_target --file db_backup.sql | |
| # Create Database | |
| psql --command "CREATE DATABASE db_target;" | |
| # Restore Database | |
| psql --host localhost --user postgres --dbname=db_target --file db_backup.sql |
System: Debian/Ubuntu/Fedora. Might work for others as well.
As mentioned here, to update a go version you will first need to uninstall the original version.
To uninstall, delete the /usr/local/go directory by:
| // Get error code | |
| pqErr := err.(*pq.Error) | |
| log.Println(pqErr.Code) | |
| // Check error message | |
| if err, ok := err.(*pq.Error); ok { | |
| fmt.Println("pq error:", err.Code.Name()) | |
| } |
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| func main() { | |
| var price = 79.90 | |
| var discount = 66.41 |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| server_name example.com www.example.com; | |
| root /var/www/example.com; | |
| index index.html; | |
| try_files $uri /index.html; | |
| } |
| CREATE DATABASE veritabani WITH ENCODING 'UTF8' LC_COLLATE='tr_TR.utf8' LC_CTYPE='tr_TR.utf8' TEMPLATE=template0; |
| docker exec containerName /usr/bin/pg_dump --user postgres --table tableName --db dbName > backup.sql | |
| -- Sunucuya tablonun yuklenmesi | |
| sudo -u postgres psql --user postgres --table tableName --db dbName < backup.sql |
| func main() { | |
| http.HandleFunc(func (w http.ResponseWriter, r *http.Request) { | |
| w.Write([]byte("ok")) | |
| }) | |
| err := http.ListenAndServe(":1234", nil) | |
| if err != nil { | |
| fmt.Println(err) | |
| } | |
| } |
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| ) | |
| func main() { | |
| res, _ := ioutil.ReadFile("/tmp/test.txt") | |
| fmt.Println(string(res)) |