Goland Cannot convert expression of type string to type []byte












2















I am using Goland for golang code and the convert check seems working with a bug while I transfer a "string" type to a "byte" type.



It can be complied correctly with a expecting result, but the tip still shows in the editor. Maybe there is something wrong in my setting? Anyone can help me?



package main

import (
"crypto/sha1"
"encoding/hex"
"fmt"
)

func Sha1(data string) string {
encrypts := sha1.New()
encrypts.Write(byte(data)) // Cannot convert expression of type string to type byte
return hex.EncodeToString(encrypts.Sum(byte("")))
}

func main() {
fmt.Println(Sha1("123456"))
}


Here is my Goland editor screenshot










share|improve this question


















  • 1





    Unfortunately, I cannot replicate this. We need more details to be able to help you. Please open an issue on our tracker and follow the instructions there in the issue template on what data to provide in order to help investigate the issue youtrack.jetbrains.com/issues/Go

    – dlsniper
    Nov 17 '18 at 1:15











  • Sorry I can’t reproduce your error with [ go version go1.11.2 darwin/amd64, GoLand 2018.3, by default setting]

    – NajlaBioinfo
    Nov 18 '18 at 20:58






  • 1





    @NajlaBioinfo I asked my classmates to check their GoLand only find the error on my own Mac. Thanks for your information, I'll open an issue on Jetbrains' website, so I can find out what's wrong with my IDE. sad :(

    – Lance_Prny
    Nov 19 '18 at 1:47











  • @dlsniper Sorry for replying you so late. I had opened an issue on your link at November 15th, and here is the link https://youtrack.jetbrains.com/issue/GO-6450. Please contact me if you need any more informations. Thanks!

    – Lance_Prny
    Nov 19 '18 at 1:51


















2















I am using Goland for golang code and the convert check seems working with a bug while I transfer a "string" type to a "byte" type.



It can be complied correctly with a expecting result, but the tip still shows in the editor. Maybe there is something wrong in my setting? Anyone can help me?



package main

import (
"crypto/sha1"
"encoding/hex"
"fmt"
)

func Sha1(data string) string {
encrypts := sha1.New()
encrypts.Write(byte(data)) // Cannot convert expression of type string to type byte
return hex.EncodeToString(encrypts.Sum(byte("")))
}

func main() {
fmt.Println(Sha1("123456"))
}


Here is my Goland editor screenshot










share|improve this question


















  • 1





    Unfortunately, I cannot replicate this. We need more details to be able to help you. Please open an issue on our tracker and follow the instructions there in the issue template on what data to provide in order to help investigate the issue youtrack.jetbrains.com/issues/Go

    – dlsniper
    Nov 17 '18 at 1:15











  • Sorry I can’t reproduce your error with [ go version go1.11.2 darwin/amd64, GoLand 2018.3, by default setting]

    – NajlaBioinfo
    Nov 18 '18 at 20:58






  • 1





    @NajlaBioinfo I asked my classmates to check their GoLand only find the error on my own Mac. Thanks for your information, I'll open an issue on Jetbrains' website, so I can find out what's wrong with my IDE. sad :(

    – Lance_Prny
    Nov 19 '18 at 1:47











  • @dlsniper Sorry for replying you so late. I had opened an issue on your link at November 15th, and here is the link https://youtrack.jetbrains.com/issue/GO-6450. Please contact me if you need any more informations. Thanks!

    – Lance_Prny
    Nov 19 '18 at 1:51
















2












2








2


1






I am using Goland for golang code and the convert check seems working with a bug while I transfer a "string" type to a "byte" type.



It can be complied correctly with a expecting result, but the tip still shows in the editor. Maybe there is something wrong in my setting? Anyone can help me?



package main

import (
"crypto/sha1"
"encoding/hex"
"fmt"
)

func Sha1(data string) string {
encrypts := sha1.New()
encrypts.Write(byte(data)) // Cannot convert expression of type string to type byte
return hex.EncodeToString(encrypts.Sum(byte("")))
}

func main() {
fmt.Println(Sha1("123456"))
}


Here is my Goland editor screenshot










share|improve this question














I am using Goland for golang code and the convert check seems working with a bug while I transfer a "string" type to a "byte" type.



It can be complied correctly with a expecting result, but the tip still shows in the editor. Maybe there is something wrong in my setting? Anyone can help me?



package main

import (
"crypto/sha1"
"encoding/hex"
"fmt"
)

func Sha1(data string) string {
encrypts := sha1.New()
encrypts.Write(byte(data)) // Cannot convert expression of type string to type byte
return hex.EncodeToString(encrypts.Sum(byte("")))
}

func main() {
fmt.Println(Sha1("123456"))
}


Here is my Goland editor screenshot







goland






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 7:02









Lance_PrnyLance_Prny

212




212








  • 1





    Unfortunately, I cannot replicate this. We need more details to be able to help you. Please open an issue on our tracker and follow the instructions there in the issue template on what data to provide in order to help investigate the issue youtrack.jetbrains.com/issues/Go

    – dlsniper
    Nov 17 '18 at 1:15











  • Sorry I can’t reproduce your error with [ go version go1.11.2 darwin/amd64, GoLand 2018.3, by default setting]

    – NajlaBioinfo
    Nov 18 '18 at 20:58






  • 1





    @NajlaBioinfo I asked my classmates to check their GoLand only find the error on my own Mac. Thanks for your information, I'll open an issue on Jetbrains' website, so I can find out what's wrong with my IDE. sad :(

    – Lance_Prny
    Nov 19 '18 at 1:47











  • @dlsniper Sorry for replying you so late. I had opened an issue on your link at November 15th, and here is the link https://youtrack.jetbrains.com/issue/GO-6450. Please contact me if you need any more informations. Thanks!

    – Lance_Prny
    Nov 19 '18 at 1:51
















  • 1





    Unfortunately, I cannot replicate this. We need more details to be able to help you. Please open an issue on our tracker and follow the instructions there in the issue template on what data to provide in order to help investigate the issue youtrack.jetbrains.com/issues/Go

    – dlsniper
    Nov 17 '18 at 1:15











  • Sorry I can’t reproduce your error with [ go version go1.11.2 darwin/amd64, GoLand 2018.3, by default setting]

    – NajlaBioinfo
    Nov 18 '18 at 20:58






  • 1





    @NajlaBioinfo I asked my classmates to check their GoLand only find the error on my own Mac. Thanks for your information, I'll open an issue on Jetbrains' website, so I can find out what's wrong with my IDE. sad :(

    – Lance_Prny
    Nov 19 '18 at 1:47











  • @dlsniper Sorry for replying you so late. I had opened an issue on your link at November 15th, and here is the link https://youtrack.jetbrains.com/issue/GO-6450. Please contact me if you need any more informations. Thanks!

    – Lance_Prny
    Nov 19 '18 at 1:51










1




1





Unfortunately, I cannot replicate this. We need more details to be able to help you. Please open an issue on our tracker and follow the instructions there in the issue template on what data to provide in order to help investigate the issue youtrack.jetbrains.com/issues/Go

– dlsniper
Nov 17 '18 at 1:15





Unfortunately, I cannot replicate this. We need more details to be able to help you. Please open an issue on our tracker and follow the instructions there in the issue template on what data to provide in order to help investigate the issue youtrack.jetbrains.com/issues/Go

– dlsniper
Nov 17 '18 at 1:15













Sorry I can’t reproduce your error with [ go version go1.11.2 darwin/amd64, GoLand 2018.3, by default setting]

– NajlaBioinfo
Nov 18 '18 at 20:58





Sorry I can’t reproduce your error with [ go version go1.11.2 darwin/amd64, GoLand 2018.3, by default setting]

– NajlaBioinfo
Nov 18 '18 at 20:58




1




1





@NajlaBioinfo I asked my classmates to check their GoLand only find the error on my own Mac. Thanks for your information, I'll open an issue on Jetbrains' website, so I can find out what's wrong with my IDE. sad :(

– Lance_Prny
Nov 19 '18 at 1:47





@NajlaBioinfo I asked my classmates to check their GoLand only find the error on my own Mac. Thanks for your information, I'll open an issue on Jetbrains' website, so I can find out what's wrong with my IDE. sad :(

– Lance_Prny
Nov 19 '18 at 1:47













@dlsniper Sorry for replying you so late. I had opened an issue on your link at November 15th, and here is the link https://youtrack.jetbrains.com/issue/GO-6450. Please contact me if you need any more informations. Thanks!

– Lance_Prny
Nov 19 '18 at 1:51







@dlsniper Sorry for replying you so late. I had opened an issue on your link at November 15th, and here is the link https://youtrack.jetbrains.com/issue/GO-6450. Please contact me if you need any more informations. Thanks!

– Lance_Prny
Nov 19 '18 at 1:51














1 Answer
1






active

oldest

votes


















1














I posted an issue on Jetbrains track, and got replied. Only to find that my GoLand inspector works well if I pasted the same code in a brand new project. So maybe there is something wrong in my "old" project, and I will post more information if I find what's wrong in my "odd" project.






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%2f53332947%2fgoland-cannot-convert-expression-of-type-string-to-type-byte%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














    I posted an issue on Jetbrains track, and got replied. Only to find that my GoLand inspector works well if I pasted the same code in a brand new project. So maybe there is something wrong in my "old" project, and I will post more information if I find what's wrong in my "odd" project.






    share|improve this answer




























      1














      I posted an issue on Jetbrains track, and got replied. Only to find that my GoLand inspector works well if I pasted the same code in a brand new project. So maybe there is something wrong in my "old" project, and I will post more information if I find what's wrong in my "odd" project.






      share|improve this answer


























        1












        1








        1







        I posted an issue on Jetbrains track, and got replied. Only to find that my GoLand inspector works well if I pasted the same code in a brand new project. So maybe there is something wrong in my "old" project, and I will post more information if I find what's wrong in my "odd" project.






        share|improve this answer













        I posted an issue on Jetbrains track, and got replied. Only to find that my GoLand inspector works well if I pasted the same code in a brand new project. So maybe there is something wrong in my "old" project, and I will post more information if I find what's wrong in my "odd" project.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 9:51









        Lance_PrnyLance_Prny

        212




        212
































            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%2f53332947%2fgoland-cannot-convert-expression-of-type-string-to-type-byte%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

            The Sandy Post

            Danny Elfman

            Pages that link to "Head v. Amoskeag Manufacturing Co."