Thursday 7 November 2019

Undefined index: HTTP_X_ELGG_APIKEY

runtime_errors":["DEBUG: 2019-11-07 13:16:34 (PST): \"Undefined index: HTTP_X_ELGG_APIKEY\" in file \/opt\/bitnami\/apache2\/htdocs\/engine\/lib\/web_services.php (line 558)"]}


Add the  following header in the request

X-Elgg-apikey

with api key value of elgg site

ref: 
http://learn.elgg.org/en/2.0/guides/web-services/hmac.html

Tuesday 5 November 2019

comment on exported type Todo should be of the form "Todo ..." (with optional leading article) go-lint

//Todo is to struct with Title in string and Done in bool
type Todo struct {
    Title string
    Done  bool
}


==========

Just start the comment with name of the variable

Refer : https://golang.org/doc/effective_go.html#commentary



Sunday 3 November 2019

get working directory golang

package main

import (
    "fmt"
    "log"
    "net/http"
    "os"

)

func main() {

    http.HandleFunc("/", HelloServer)
    http.ListenAndServe(":8080"nil)
}


func HelloServer(w http.ResponseWriter, r *http.Request) {

    direrr := os.Getwd()
    if err != nil {
        log.Fatal(err)
    }

    fmt.Fprintf(w, "Hello, %s!", dir)
}