Display database table in html table like gridview

Oh, that was good, that crystallized why I dislike the

if err := MoreWork(another); err != nil {
    return nil, err
}

construction. I hadn’t really put much thought into it before, I just instinctively disliked it.

2 Likes

Helps to share the link, otherwise its hard to find :slight_smile:

1 Like

yeah. At least now you have a definition to your dislikes

thanks @nathankerr :hamburger::relieved:

1 Like

I also used to dislike the if err := foo(); err != nil ... construction due to hiding the actual work inside an if. But it turns out (for me) that this is mostly a matter of getting used to it. After seeing it five thousand times it’s as clear as the expanded err := foo(); if err := nil ... variant.

That may still mean it’s not great. Go is optimized for clarity when read, and the combined if is one of the few cases where Go offers brevity at the expense of readability…

1 Like

sorry just discovered a bug in my code. It’s either the readUser() (doubt) or the deleteUser(){probably).
Any time I go to the /read route, it removes the last user in the table.
Don’t know what’s going on.

As there is no code, we can’t tell either.

sorry about that, here’s the code:
on playground
first tried to get all the id’s from db then display it on html page using <select> to enable me loop through and output all of them. Then the selected id is then deleted when the form is submitted. Although I tried getting the username but maybe that’s too much for me to handle now.

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