Skip to content

Instantly share code, notes, and snippets.

View ahmadudin's full-sized avatar
🏠
Working from home

Ahmad S ahmadudin

🏠
Working from home
View GitHub Profile
func TestCreate(t *testing.T) {
var db *sql.DB
db, mock, err := sqlmock.New() // mock sql.DB
if err != nil {
t.Error(err)
return
}
gdb, err := gorm.Open(postgres.New(postgres.Config{Conn: db}), &gorm.Config{}) // open gorm db
@ahmadudin
ahmadudin / latest-protobuf-ubuntu-18-04.md
Last active April 15, 2020 06:30 — forked from diegopacheco/latest-protobuf-ubuntu-18-04.md
How to Install Latest Protobuf on Ubuntu 18.04
sudo apt-get install autoconf automake libtool curl make g++ unzip -y
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make
make check
sudo make install
apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (useful for CLI installs) installed
&& apt-get -y install git procps lsb-release \
#
# Install C++ tools
&& apt-get -y install build-essential cmake cppcheck valgrind \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.