Signal: killed Process finished with exit code 1, what I am wrong?

Here is main.go

package main

import (
	_ ""

type Page struct {
	Name string
	DBStatus bool

func main() {
	templates := template.Must(template.ParseFiles("templates/index.html"))

	db, _ := sql.Open("sqlite3", "dev.db")

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		p := Page{Name: "Gopher", DBStatus: false}
		if name := r.FormValue("name"); name != "" {
			p.Name = name

		p.DBStatus = db.Ping() == nil

		if err := templates.ExecuteTemplate(w, "index.html", p); err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)


	fmt.Println(http.ListenAndServe(":8080", nil))

and here is my index.html

<p>Hello, {{.Name}}</p>

{{if .DBStatus}}
<p>The database connection is alive!</p>
<p>The database connection is dead!</p>

When I run main.go I get the message

signal: killed

Process finished with exit code 1

I have install the go get

Please check the returned error in sql.Open!

I was unable to replicate the error.

go1.8.1, macOS 10.12.4

1 Like

Yes @nathankerr the same my env.

Wrong version of libsqlite3 perhaps? embeds sqlite and does not use an external version.

any solution to make it works @nathankerr

I could not replicate the problem. I tried to replicate it again, but could not.

I ran go build, ran the resulting executable, pointed my browser at and received:

Hello, Gopher

The database connection is alive!

My process was not killed. I got the result I expected from the program. It works for me.

Since I can’t find the problem you described, I can’t find a solution for it.

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