If Docker is not already installed, follow these steps:
- Linux/MacOS:
- Refer to the official documentation to install Docker: https://docs.docker.com/get-docker/
- Windows:
- Install Docker Desktop: https://www.docker.com/products/docker-desktop/
After installation, verify Docker is running with the following command:
docker --version-
Pull the PostgreSQL 13 image:
docker pull postgres:13
-
Create and run a PostgreSQL container:
docker run -d \ --name postgres13 \ -e POSTGRES_USER=your_username \ -e POSTGRES_PASSWORD=your_password \ -e POSTGRES_DB=your_database \ -p 5432:5432 \ postgres:13
- POSTGRES_USER: Set the PostgreSQL username (e.g.,
postgres). - POSTGRES_PASSWORD: Set the PostgreSQL password.
- POSTGRES_DB: Set the default database name.
- -p 5432:5432: Map port 5432 on your machine to port 5432 in the container.
- POSTGRES_USER: Set the PostgreSQL username (e.g.,
-
Check the container status:
docker ps
If successful, you will see a container named
postgres13. -
Access the PostgreSQL container:
docker exec -it postgres13 bash
Run the following command on your host machine to copy cgo.dump into the container:
docker cp cgo.dump postgres13:/tmp/cgo.dump-
Access the container and switch to the PostgreSQL user:
docker exec -it postgres13 bash su - postgres -
Restore the database using
pg_restore:pg_restore -U your_username -d your_database /tmp/cgo.dump
- your_username: Specify the database username.
- your_database: Specify the target database name.
-
To clean the target database before importing, add the
--cleanoption:pg_restore -U your_username -d your_database --clean /tmp/cgo.dump
-
Verify the import: Log into the database and check the data:
psql -U your_username -d your_database \dt
You can install PgAdmin to access the imported data using a graphical interface. You can download the installer from the official website
- download Go1.17.7 toolchain source code: https://go.dev/dl/go1.17.7.src.tar.gz
wget https://go.dev/dl/go1.17.7.src.tar.gz- extract toolchain source code
tar -xzvf go1.17.7.src.tar.gz- extract our
go1.17.7_cgoptr.tar.gz
tar -xzvf go1.17.7_cgoptr.tar.gz- overwrite the original Go1.17.7 toolchain source with the extracted file
cd go1.17.7_cgoptr
cp -r * ../go/- build the modifiled toochain
cd ../go/src
./make.bash # buildnote: to build the modified toolchain, your machine must have Go installation (need the Go compiler to build the Go toolchain). ref Download and install - The Go Programming Language for details.
- verify your build
cd ../bin
./go --versionyou can add this to your $PATH. and modify your $GOROOT if you want to use the modified toolchain later.
see Go Wiki: InstallTroubleshooting - The Go Programming Language for how to set $GOROOT.