Using beego captcha: invalid memory address or nil pointer dereference










0















I want to use captcha to generate a verification code under Beego. But it has the error invalid memory address or nil pointer dereference.Does anyone know how to solve this problem? Thank you.



Request Method: GET
Request URL: /accounts/forgotpassword
RemoteAddr: 127.0.0.1
Stack
C:/Go/src/runtime/asm_amd64.s:573
C:/Go/src/runtime/panic.go:505
C:/Go/src/text/template/exec.go:137
C:/Go/src/runtime/asm_amd64.s:573
C:/Go/src/runtime/panic.go:505
C:/Go/src/runtime/panic.go:63
C:/Go/src/runtime/signal_windows.go:167
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:186
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:164
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:267
C:/Go/src/runtime/asm_amd64.s:573
C:/Go/src/reflect/value.go:447
C:/Go/src/reflect/value.go:308
C:/Go/src/text/template/exec.go:667
C:/Go/src/text/template/exec.go:535
C:/Go/src/text/template/exec.go:432
C:/Go/src/text/template/exec.go:405
C:/Go/src/text/template/exec.go:231
C:/Go/src/text/template/exec.go:239
C:/Go/src/text/template/exec.go:194
C:/Go/src/text/template/exec.go:177
C:/Go/src/html/template/template.go:137
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/template.go:66
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:283
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:234
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:214
D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/router.go:863
C:/Go/src/net/http/server.go:2694
C:/Go/src/net/http/server.go:1830
C:/Go/src/runtime/asm_amd64.s:2361



My Code:
confapp.conf



# Cache Provider
CacheProvider = redis
CacheConnection = "conn":"127.0.0.1:6379"


controllersmain.go



package controllers

import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/cache"
"github.com/astaxie/beego/utils/captcha"
)


var(
cpt *captcha.Captcha
CacheProvider string = beego.AppConfig.String("CacheProvider")
CacheConnection string = beego.AppConfig.String("CacheConnection")
)


func init()
store, _ := cache.NewCache(CacheProvider, CacheConnection)
cpt = captcha.NewWithFilter("/accounts/captca/", store)



viewsforgotpasswordcontrollerget.tpl



<div class="w3-container w3-center">
<form method="post" id="mainForm"class="w3-container" style="margin-top:90px">
<div class="w3-card " style=" padding-left: 0px;
padding-right: 0px; margin-top: 30px;">
<div class="w3-container">
<h1>Reset password</h1>
</div><div class="w3-container" style=" padding-bottom: 16px;">
create_captcha
<input type="text" class="w3-input "name="captcha"style="outline: none;">
<p style="text-align: left;margin-top: 0px;color:red">
if .Errors.Captcha
.Errors.Captchaelse&zwnj;end</p>
<input type="submit" value="Request reset password" onclick="login()" class="w3-button w3-indigo w3-block w3-round-large">
</div>
</div>
</form>
</div>


controllersforgotpassword.go



package controllers

import (
"github.com/astaxie/beego"
)


type ForgotPasswordController struct
beego.Controller



func (c *ForgotPasswordController) Get()
beego.Debug("In ForgotPasswordController:Get - Start")
c.Layout = "shared/layout.tpl"
//end ForgotPasswordController:Get()


func (this *ForgotPasswordController) Post()

beego.Debug("In ForgotPasswordController:Post - Start")

captchaVerification := cpt.VerifyReq(this.Ctx.Request)

if !captchaVerification
errormap := make(map[string]string)
beego.Debug("In ForgotPasswordController:Post - captchaVerification Got wrong captcha")
errormap["Captcha"] = "Sorry but the characters you endered didn't match. Please try again"
this.Data["Errors"] = errormap
return


//end ForgotPassword() func



Environment



  • go version go1.10 windows/amd64

  • Beego : 1.10.1









share|improve this question


























    0















    I want to use captcha to generate a verification code under Beego. But it has the error invalid memory address or nil pointer dereference.Does anyone know how to solve this problem? Thank you.



    Request Method: GET
    Request URL: /accounts/forgotpassword
    RemoteAddr: 127.0.0.1
    Stack
    C:/Go/src/runtime/asm_amd64.s:573
    C:/Go/src/runtime/panic.go:505
    C:/Go/src/text/template/exec.go:137
    C:/Go/src/runtime/asm_amd64.s:573
    C:/Go/src/runtime/panic.go:505
    C:/Go/src/runtime/panic.go:63
    C:/Go/src/runtime/signal_windows.go:167
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:186
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:164
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:267
    C:/Go/src/runtime/asm_amd64.s:573
    C:/Go/src/reflect/value.go:447
    C:/Go/src/reflect/value.go:308
    C:/Go/src/text/template/exec.go:667
    C:/Go/src/text/template/exec.go:535
    C:/Go/src/text/template/exec.go:432
    C:/Go/src/text/template/exec.go:405
    C:/Go/src/text/template/exec.go:231
    C:/Go/src/text/template/exec.go:239
    C:/Go/src/text/template/exec.go:194
    C:/Go/src/text/template/exec.go:177
    C:/Go/src/html/template/template.go:137
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/template.go:66
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:283
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:234
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:214
    D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/router.go:863
    C:/Go/src/net/http/server.go:2694
    C:/Go/src/net/http/server.go:1830
    C:/Go/src/runtime/asm_amd64.s:2361



    My Code:
    confapp.conf



    # Cache Provider
    CacheProvider = redis
    CacheConnection = "conn":"127.0.0.1:6379"


    controllersmain.go



    package controllers

    import (
    "github.com/astaxie/beego"
    "github.com/astaxie/beego/cache"
    "github.com/astaxie/beego/utils/captcha"
    )


    var(
    cpt *captcha.Captcha
    CacheProvider string = beego.AppConfig.String("CacheProvider")
    CacheConnection string = beego.AppConfig.String("CacheConnection")
    )


    func init()
    store, _ := cache.NewCache(CacheProvider, CacheConnection)
    cpt = captcha.NewWithFilter("/accounts/captca/", store)



    viewsforgotpasswordcontrollerget.tpl



    <div class="w3-container w3-center">
    <form method="post" id="mainForm"class="w3-container" style="margin-top:90px">
    <div class="w3-card " style=" padding-left: 0px;
    padding-right: 0px; margin-top: 30px;">
    <div class="w3-container">
    <h1>Reset password</h1>
    </div><div class="w3-container" style=" padding-bottom: 16px;">
    create_captcha
    <input type="text" class="w3-input "name="captcha"style="outline: none;">
    <p style="text-align: left;margin-top: 0px;color:red">
    if .Errors.Captcha
    .Errors.Captchaelse&zwnj;end</p>
    <input type="submit" value="Request reset password" onclick="login()" class="w3-button w3-indigo w3-block w3-round-large">
    </div>
    </div>
    </form>
    </div>


    controllersforgotpassword.go



    package controllers

    import (
    "github.com/astaxie/beego"
    )


    type ForgotPasswordController struct
    beego.Controller



    func (c *ForgotPasswordController) Get()
    beego.Debug("In ForgotPasswordController:Get - Start")
    c.Layout = "shared/layout.tpl"
    //end ForgotPasswordController:Get()


    func (this *ForgotPasswordController) Post()

    beego.Debug("In ForgotPasswordController:Post - Start")

    captchaVerification := cpt.VerifyReq(this.Ctx.Request)

    if !captchaVerification
    errormap := make(map[string]string)
    beego.Debug("In ForgotPasswordController:Post - captchaVerification Got wrong captcha")
    errormap["Captcha"] = "Sorry but the characters you endered didn't match. Please try again"
    this.Data["Errors"] = errormap
    return


    //end ForgotPassword() func



    Environment



    • go version go1.10 windows/amd64

    • Beego : 1.10.1









    share|improve this question
























      0












      0








      0








      I want to use captcha to generate a verification code under Beego. But it has the error invalid memory address or nil pointer dereference.Does anyone know how to solve this problem? Thank you.



      Request Method: GET
      Request URL: /accounts/forgotpassword
      RemoteAddr: 127.0.0.1
      Stack
      C:/Go/src/runtime/asm_amd64.s:573
      C:/Go/src/runtime/panic.go:505
      C:/Go/src/text/template/exec.go:137
      C:/Go/src/runtime/asm_amd64.s:573
      C:/Go/src/runtime/panic.go:505
      C:/Go/src/runtime/panic.go:63
      C:/Go/src/runtime/signal_windows.go:167
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:186
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:164
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:267
      C:/Go/src/runtime/asm_amd64.s:573
      C:/Go/src/reflect/value.go:447
      C:/Go/src/reflect/value.go:308
      C:/Go/src/text/template/exec.go:667
      C:/Go/src/text/template/exec.go:535
      C:/Go/src/text/template/exec.go:432
      C:/Go/src/text/template/exec.go:405
      C:/Go/src/text/template/exec.go:231
      C:/Go/src/text/template/exec.go:239
      C:/Go/src/text/template/exec.go:194
      C:/Go/src/text/template/exec.go:177
      C:/Go/src/html/template/template.go:137
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/template.go:66
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:283
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:234
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:214
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/router.go:863
      C:/Go/src/net/http/server.go:2694
      C:/Go/src/net/http/server.go:1830
      C:/Go/src/runtime/asm_amd64.s:2361



      My Code:
      confapp.conf



      # Cache Provider
      CacheProvider = redis
      CacheConnection = "conn":"127.0.0.1:6379"


      controllersmain.go



      package controllers

      import (
      "github.com/astaxie/beego"
      "github.com/astaxie/beego/cache"
      "github.com/astaxie/beego/utils/captcha"
      )


      var(
      cpt *captcha.Captcha
      CacheProvider string = beego.AppConfig.String("CacheProvider")
      CacheConnection string = beego.AppConfig.String("CacheConnection")
      )


      func init()
      store, _ := cache.NewCache(CacheProvider, CacheConnection)
      cpt = captcha.NewWithFilter("/accounts/captca/", store)



      viewsforgotpasswordcontrollerget.tpl



      <div class="w3-container w3-center">
      <form method="post" id="mainForm"class="w3-container" style="margin-top:90px">
      <div class="w3-card " style=" padding-left: 0px;
      padding-right: 0px; margin-top: 30px;">
      <div class="w3-container">
      <h1>Reset password</h1>
      </div><div class="w3-container" style=" padding-bottom: 16px;">
      create_captcha
      <input type="text" class="w3-input "name="captcha"style="outline: none;">
      <p style="text-align: left;margin-top: 0px;color:red">
      if .Errors.Captcha
      .Errors.Captchaelse&zwnj;end</p>
      <input type="submit" value="Request reset password" onclick="login()" class="w3-button w3-indigo w3-block w3-round-large">
      </div>
      </div>
      </form>
      </div>


      controllersforgotpassword.go



      package controllers

      import (
      "github.com/astaxie/beego"
      )


      type ForgotPasswordController struct
      beego.Controller



      func (c *ForgotPasswordController) Get()
      beego.Debug("In ForgotPasswordController:Get - Start")
      c.Layout = "shared/layout.tpl"
      //end ForgotPasswordController:Get()


      func (this *ForgotPasswordController) Post()

      beego.Debug("In ForgotPasswordController:Post - Start")

      captchaVerification := cpt.VerifyReq(this.Ctx.Request)

      if !captchaVerification
      errormap := make(map[string]string)
      beego.Debug("In ForgotPasswordController:Post - captchaVerification Got wrong captcha")
      errormap["Captcha"] = "Sorry but the characters you endered didn't match. Please try again"
      this.Data["Errors"] = errormap
      return


      //end ForgotPassword() func



      Environment



      • go version go1.10 windows/amd64

      • Beego : 1.10.1









      share|improve this question














      I want to use captcha to generate a verification code under Beego. But it has the error invalid memory address or nil pointer dereference.Does anyone know how to solve this problem? Thank you.



      Request Method: GET
      Request URL: /accounts/forgotpassword
      RemoteAddr: 127.0.0.1
      Stack
      C:/Go/src/runtime/asm_amd64.s:573
      C:/Go/src/runtime/panic.go:505
      C:/Go/src/text/template/exec.go:137
      C:/Go/src/runtime/asm_amd64.s:573
      C:/Go/src/runtime/panic.go:505
      C:/Go/src/runtime/panic.go:63
      C:/Go/src/runtime/signal_windows.go:167
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:186
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:164
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/utils/captcha/captcha.go:267
      C:/Go/src/runtime/asm_amd64.s:573
      C:/Go/src/reflect/value.go:447
      C:/Go/src/reflect/value.go:308
      C:/Go/src/text/template/exec.go:667
      C:/Go/src/text/template/exec.go:535
      C:/Go/src/text/template/exec.go:432
      C:/Go/src/text/template/exec.go:405
      C:/Go/src/text/template/exec.go:231
      C:/Go/src/text/template/exec.go:239
      C:/Go/src/text/template/exec.go:194
      C:/Go/src/text/template/exec.go:177
      C:/Go/src/html/template/template.go:137
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/template.go:66
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:283
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:234
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/controller.go:214
      D:/Google Drive/Work/GoWorkspace/src/github.com/astaxie/beego/router.go:863
      C:/Go/src/net/http/server.go:2694
      C:/Go/src/net/http/server.go:1830
      C:/Go/src/runtime/asm_amd64.s:2361



      My Code:
      confapp.conf



      # Cache Provider
      CacheProvider = redis
      CacheConnection = "conn":"127.0.0.1:6379"


      controllersmain.go



      package controllers

      import (
      "github.com/astaxie/beego"
      "github.com/astaxie/beego/cache"
      "github.com/astaxie/beego/utils/captcha"
      )


      var(
      cpt *captcha.Captcha
      CacheProvider string = beego.AppConfig.String("CacheProvider")
      CacheConnection string = beego.AppConfig.String("CacheConnection")
      )


      func init()
      store, _ := cache.NewCache(CacheProvider, CacheConnection)
      cpt = captcha.NewWithFilter("/accounts/captca/", store)



      viewsforgotpasswordcontrollerget.tpl



      <div class="w3-container w3-center">
      <form method="post" id="mainForm"class="w3-container" style="margin-top:90px">
      <div class="w3-card " style=" padding-left: 0px;
      padding-right: 0px; margin-top: 30px;">
      <div class="w3-container">
      <h1>Reset password</h1>
      </div><div class="w3-container" style=" padding-bottom: 16px;">
      create_captcha
      <input type="text" class="w3-input "name="captcha"style="outline: none;">
      <p style="text-align: left;margin-top: 0px;color:red">
      if .Errors.Captcha
      .Errors.Captchaelse&zwnj;end</p>
      <input type="submit" value="Request reset password" onclick="login()" class="w3-button w3-indigo w3-block w3-round-large">
      </div>
      </div>
      </form>
      </div>


      controllersforgotpassword.go



      package controllers

      import (
      "github.com/astaxie/beego"
      )


      type ForgotPasswordController struct
      beego.Controller



      func (c *ForgotPasswordController) Get()
      beego.Debug("In ForgotPasswordController:Get - Start")
      c.Layout = "shared/layout.tpl"
      //end ForgotPasswordController:Get()


      func (this *ForgotPasswordController) Post()

      beego.Debug("In ForgotPasswordController:Post - Start")

      captchaVerification := cpt.VerifyReq(this.Ctx.Request)

      if !captchaVerification
      errormap := make(map[string]string)
      beego.Debug("In ForgotPasswordController:Post - captchaVerification Got wrong captcha")
      errormap["Captcha"] = "Sorry but the characters you endered didn't match. Please try again"
      this.Data["Errors"] = errormap
      return


      //end ForgotPassword() func



      Environment



      • go version go1.10 windows/amd64

      • Beego : 1.10.1






      go beego






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 3:53









      user906919user906919

      118212




      118212






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Just tested your code in my local. The error is coming from cache creation part.



          store, err := cache.NewCache(CacheProvider, CacheConnection)
          if err != nil
          log.Fatal(err.Error())
          os.Exit(0)



          To get the detailed error, check the err variable returned from cache.NewCache(). Also it's a best practice to always log any possible error coming from error object, don't ignore it.



          Here is the error log:




          2018/11/14 11:13:24 cache: unknown adapter name "redis" (forgot to import?)




          The error above is occurred because cache package not able to find redis adapter. It's because you haven't imported the package. So let's try to import it, then your problem will be solved.



          import (
          "fmt"
          "log"
          "os"
          "github.com/astaxie/beego"
          "github.com/astaxie/beego/cache"
          "github.com/astaxie/beego/utils/captcha"

          _ "github.com/astaxie/beego/cache/redis" // <----- this one
          )


          Since we don't interact with the cache redis package directly, import it with _.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292963%2fusing-beego-captcha-invalid-memory-address-or-nil-pointer-dereference%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Just tested your code in my local. The error is coming from cache creation part.



            store, err := cache.NewCache(CacheProvider, CacheConnection)
            if err != nil
            log.Fatal(err.Error())
            os.Exit(0)



            To get the detailed error, check the err variable returned from cache.NewCache(). Also it's a best practice to always log any possible error coming from error object, don't ignore it.



            Here is the error log:




            2018/11/14 11:13:24 cache: unknown adapter name "redis" (forgot to import?)




            The error above is occurred because cache package not able to find redis adapter. It's because you haven't imported the package. So let's try to import it, then your problem will be solved.



            import (
            "fmt"
            "log"
            "os"
            "github.com/astaxie/beego"
            "github.com/astaxie/beego/cache"
            "github.com/astaxie/beego/utils/captcha"

            _ "github.com/astaxie/beego/cache/redis" // <----- this one
            )


            Since we don't interact with the cache redis package directly, import it with _.






            share|improve this answer



























              1














              Just tested your code in my local. The error is coming from cache creation part.



              store, err := cache.NewCache(CacheProvider, CacheConnection)
              if err != nil
              log.Fatal(err.Error())
              os.Exit(0)



              To get the detailed error, check the err variable returned from cache.NewCache(). Also it's a best practice to always log any possible error coming from error object, don't ignore it.



              Here is the error log:




              2018/11/14 11:13:24 cache: unknown adapter name "redis" (forgot to import?)




              The error above is occurred because cache package not able to find redis adapter. It's because you haven't imported the package. So let's try to import it, then your problem will be solved.



              import (
              "fmt"
              "log"
              "os"
              "github.com/astaxie/beego"
              "github.com/astaxie/beego/cache"
              "github.com/astaxie/beego/utils/captcha"

              _ "github.com/astaxie/beego/cache/redis" // <----- this one
              )


              Since we don't interact with the cache redis package directly, import it with _.






              share|improve this answer

























                1












                1








                1







                Just tested your code in my local. The error is coming from cache creation part.



                store, err := cache.NewCache(CacheProvider, CacheConnection)
                if err != nil
                log.Fatal(err.Error())
                os.Exit(0)



                To get the detailed error, check the err variable returned from cache.NewCache(). Also it's a best practice to always log any possible error coming from error object, don't ignore it.



                Here is the error log:




                2018/11/14 11:13:24 cache: unknown adapter name "redis" (forgot to import?)




                The error above is occurred because cache package not able to find redis adapter. It's because you haven't imported the package. So let's try to import it, then your problem will be solved.



                import (
                "fmt"
                "log"
                "os"
                "github.com/astaxie/beego"
                "github.com/astaxie/beego/cache"
                "github.com/astaxie/beego/utils/captcha"

                _ "github.com/astaxie/beego/cache/redis" // <----- this one
                )


                Since we don't interact with the cache redis package directly, import it with _.






                share|improve this answer













                Just tested your code in my local. The error is coming from cache creation part.



                store, err := cache.NewCache(CacheProvider, CacheConnection)
                if err != nil
                log.Fatal(err.Error())
                os.Exit(0)



                To get the detailed error, check the err variable returned from cache.NewCache(). Also it's a best practice to always log any possible error coming from error object, don't ignore it.



                Here is the error log:




                2018/11/14 11:13:24 cache: unknown adapter name "redis" (forgot to import?)




                The error above is occurred because cache package not able to find redis adapter. It's because you haven't imported the package. So let's try to import it, then your problem will be solved.



                import (
                "fmt"
                "log"
                "os"
                "github.com/astaxie/beego"
                "github.com/astaxie/beego/cache"
                "github.com/astaxie/beego/utils/captcha"

                _ "github.com/astaxie/beego/cache/redis" // <----- this one
                )


                Since we don't interact with the cache redis package directly, import it with _.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 4:22









                xparexpare

                4,7022249




                4,7022249





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292963%2fusing-beego-captcha-invalid-memory-address-or-nil-pointer-dereference%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Use pre created SQLite database for Android project in kotlin

                    Darth Vader #20

                    Ondo