Connecting SqLite With Go

package main

import (
    "database/sql"
    "fmt"
    "time"
    "github.com/mattn/go-sqlite3 "
)

while installing in cmd
go get github.com/mattn/go-sqlite3

error: gcc executable file not found in path

You need to install gcc.

i tried mingw but same error

So you are using windows?

Have you explicitly installed GCC in your POSIX wrapper?

If you do not need a windows executable file, have you tried using the wsl?

Looks like you are extremely early in your project. Take a look at https://github.com/avelino/awesome-go#database to view most of the databases you can use with go. You can chose a database that doesn’t require gcc for compiling.

Otherwise as others have pointed out, you need to install gcc as go-sqlite-3 is a cgo package.

I was able to pull it down without any problems on Linux machine. Perhaps the issues was fix. Can you try again?

go get github.com/mattn/go-sqlite3 
echo $?
0

gcc -v 
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) 

uname -a
Linux dev-vm 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.