HomeVideos

I am done with Golang

Now Playing

I am done with Golang

Transcript

337 segments

0:00

It's been no secret that I I love Go,

0:02

okay? I have spent many an hour

0:04

programming on Go. I built an entire

0:06

whole like Doom where a thousand people

0:09

could play Doom all at the same time via

0:11

Go. I have been a big fan of Go for a

0:13

very very long time. It was one of my

0:16

go-to languages that I would reach for

0:18

whenever I'd want to build anything that

0:19

kind of interacts with the command line,

0:22

anything that needs to interact with the

0:23

system. Very quick, very simple, and

0:25

honestly, I just have a lot of warm

0:27

feelings about it. But I do know it's a

0:28

simple language. There's nothing about

0:30

it that was complex. There was nothing

0:32

about it that you could do or represent

0:34

in a complex way. And that's honestly

0:36

been a huge appeal for me is that I

0:38

could do so much because all I would

0:40

care about and all I would focus on is

0:43

writing about the problem as opposed to

0:45

solving the kind of ancillary problem.

0:48

And this has been the Go mantra for a

0:49

long, long time, which is like you go

0:51

into any Go project,

0:53

pretty quickly you can feel at home.

0:55

Everyone uses the same formatter. Every

0:57

function effectively looks like you

0:59

would write it to do. Everything is

1:01

pretty constrained in the exact same way

1:02

cuz there's really only one way to write

1:04

Go. But those days, they're changed. And

1:07

we're going to be doing a lot of yapping

1:08

here, so I hope that you're prepared

1:10

because this is one of those passionate

1:11

yaps where it's like I feel like my

1:14

childhood's being ripped away from me,

1:16

okay? Now, before we kick off this whole

1:18

Go apocalypse that I'm going to be

1:20

yapping about, I do want to kind of give

1:21

you my first introduction into Go. it

1:23

was right around 2015, 2016 I started

1:26

writing Go a little bit more seriously.

1:28

And of course, I became so kind of Go

1:30

pilled or Go brained that

1:32

there's certain phrases that I couldn't

1:34

understand about other languages if you

1:36

said it to me. Like I it wouldn't land

1:38

on me. A good example is I was at

1:39

Facebook interviewing. Yes, I

1:41

interviewed for the performance team.

1:43

And during that time, they asked me a

1:46

simple question, which was, "Hey, how do

1:47

you return multiple values in

1:49

JavaScript?" Now, me personally, I'm I'm

1:51

in Go land and I'm like, "Bro, you can't

1:53

do that, okay? Go has multiple return

1:55

values. JavaScript doesn't have multiple

1:57

What the hell you talking about? And of

1:59

course, then the person's they they

2:00

thought I was an idiot because they're

2:01

like, you return an object, you dummy,

2:03

or an array. And I'm like, but that's

2:04

one value.

2:06

>> [laughter]

2:06

>> And I just remember being so offended by

2:08

that and I was just so go-pilled I

2:10

couldn't hear what he was trying to say.

2:12

You get the idea. I failed the interview

2:13

so massively on such a stupid thing.

2:16

Anyhow, so my Go days have been long.

2:19

I've really enjoyed it. I've used it for

2:21

quite a few years. And I'd have to say,

2:23

it's been one of my favorites. Now,

2:24

before we begin, I'd like to say thank

2:25

you to the sponsor and a quick word.

2:30

HEY, DO YOU LIKE WAITING? YEAH. Neither

2:32

do I. With Blacksmith, you get speed, 2x

2:35

faster hardware, 4x faster cache

2:38

downloads, and 40x faster Docker builds.

2:41

So, stop waiting around. Use their

2:43

migration wizard to easily transition

2:45

your repos onto Blacksmith today. Thank

2:48

you, Blacksmith, for sponsoring this

2:49

video. And you, check out the links down

2:51

below.

2:53

Hi. All right, so welcome back. Uh it

2:55

turns out that now Go and Go 1.27,

2:58

you can do uh generics even on method

3:01

receivers. For those that don't know,

3:03

for a long time in Go, you could only do

3:05

it in functions. If you don't know what

3:07

a method receiver is, effectively, you

3:09

can create a struct and something that

3:10

looks like a function hanging off the

3:12

struct would be a method receiver. It'd

3:14

actually be a function that's associated

3:16

with some data, just like an object or a

3:18

class. And you could never do generics

3:20

on that. You could only just do it on

3:21

free-form functions, and that's it. But

3:23

now, in our new world that we live in,

3:26

you can now do it on everything. So, you

3:28

can actually see right here, here's a

3:29

result object, right? And it can have a

3:32

value V or an error error. And I have an

3:34

is okay function, like, "Hey, are you

3:37

okay if the error equals nil? Yes, you

3:39

are. Okay, awesome. You're okay." And

3:41

this is generic over the value V, which

3:43

means I can also do things like this. I

3:45

can return a result of type foo, which

3:48

means it has an error. And then I can go

3:49

in here and do all of this beautiful

3:51

code, where now I have a results object,

3:53

which means I can write code that looks

3:55

a bit more like this. I can convert a

3:57

read operation into a result. I can then

3:59

stringify it from bytes, and then I can

4:01

parse it, unwrap it, and print it right

4:03

here. If my file contains an error, it's

4:06

going to let me know, "Hey, there's an

4:08

error in whatever you're attempting to

4:10

parse." If I jump back over here, go in

4:12

here, jump this thing, and say turn it

4:14

into 69, nice, rerun this thing, you'll

4:16

see right here, "Hello, 69." Everything

4:19

parsed fine. So, I know at this point

4:21

people are looking at this and going,

4:22

"Hey, I kind of like that style of

4:24

code." This would be nice code for me to

4:26

work on with Go. And I do hear you. This

4:29

is generally nice code, but you have to

4:31

kind of take a step back and understand

4:34

Go from the very beginning. The very

4:36

mantra of Go is that there's one way to

4:37

do anything. Do you think that this is

4:39

going to lead to one way to do

4:40

something, or now you're going to have a

4:42

cornucopia of different ways in which

4:44

you're going to do stuff? You're going

4:45

to jump into code bases and have no idea

4:48

how they work. You're going to have to

4:49

go through layers of abstraction and

4:51

whole new ways in which to express

4:52

things, in which is just going to be

4:54

like every other language, just without

4:56

all the conveniences. A good example of

4:58

that is if you wanted to do a You can't

5:00

do like a generic convert function,

5:02

where I can convert any function with

5:04

any length of arguments into a result

5:06

type. So, instead you have like convert

5:07

one, convert zero, convert two, convert

5:10

three. I've tried many times to get some

5:11

version of this working, and I could not

5:14

seem to get this version of this thing

5:16

working right here. Whereas something

5:17

like this in TypeScript, very easy to

5:20

do, right? Like, okay, there you go. You

5:22

can convert any amount of arguments into

5:24

this. And so, it's like the actual

5:26

genericism that Go lang is providing is,

5:29

in fact, not that good. But then on top

5:32

of it, it's just going to make every

5:34

code base completely different. And this

5:37

was the entire argument, by the way, as

5:40

to why they were not going to do error

5:42

handling. Error handling has

5:44

historically always been the butt of a

5:46

joke for when it comes to go, because if

5:48

you wanted to do something like this,

5:49

print some, you'd have to take the two

5:51

strings coming in, convert the first

5:53

string into a number, which could result

5:55

in an error, cuz that makes sense,

5:56

right? If I try to convert hello into a

5:59

number, well, it's not a number. It's an

6:00

error, actually. And so, there we go. We

6:02

have an error. Yeah, I convert B, that's

6:04

into an error. Then I can finally print

6:06

then I can finally return. So, that

6:07

means this is error handling code, error

6:09

handling code, error handling code. That

6:10

means there are 1 2 3 lines of actual

6:14

code, whereas there's 1 4 7 lines of

6:19

code dedicated to error handling. And

6:22

this has always been the big problem.

6:23

Now, I personally have enjoyed this kind

6:25

of error handling, cuz that means every

6:27

single time I do something that could

6:30

error, I know it, and I have to

6:32

explicitly handle it. Now, granted,

6:34

there could be some more ergonomics

6:36

around it, but nonetheless, I've

6:37

actually really appreciated that about

6:39

Go. And the reason why they said, "No,

6:41

hey, we're not doing fancy error

6:43

handling, okay? We're not going to be

6:45

throwing in tries. We're not going to be

6:47

throwing in some sort of extra error

6:48

capture up here. No, we're not going to

6:51

be throwing in little question marks

6:52

like we're Rust, okay? We're not doing

6:53

any of that brother. Okay, we're

6:55

going to keep Go Go, the end." And

6:58

honestly, you may not like that, but to

7:00

me, that is okay, because that is one

7:03

thing I have appreciated about it. Every

7:05

code base is the same. Now, we have a

7:07

whole new set of problems. We now have

7:09

iterators. So, now you're hiding what's

7:11

actually happening. Again, another thing

7:13

I loved about Go. Everything you did,

7:15

you understood the cost. When you need

7:17

to iterate over a list, you could

7:19

understand what's happening. Now, all

7:21

sorts of stuff could be hidden from you

7:23

due to iterators. We now also have

7:26

generics. And in fact, this has led to a

7:28

very good article called Go's evolving

7:30

in the wrong direction, because here's

7:32

the deal.

7:33

If you want a fancy type system, don't

7:35

use Go. So, now that they're adding all

7:37

these features, you still get all the

7:39

crappy type system of Go that was good

7:41

because of the way it was, an unabashed

7:44

procedural language, right? It's purely

7:46

imperative. Nothing about it was fancy.

7:48

But instead, it's like you get Rust

7:50

light. You get kind of like the worst

7:53

version of Rust or the worst version of

7:55

TypeScript. Brother, if I wanted those,

7:57

I should just go and use those other

7:59

languages. They have significantly

8:02

better items to offer if this is what I

8:04

was going for. I use Go for what it was,

8:08

not so that it could look like every

8:10

other language just with a new set of

8:12

syntax. This is the thing that really

8:14

bothers me about Go. Go knew what it

8:17

was, and that's one thing that was very

8:19

special about Go. A strong standard

8:21

library, a very simple language. Now,

8:23

yes, could they have made error handling

8:25

better? Absolutely. Could they have made

8:28

enums of any kind? Absolutely, and I

8:31

think that would have dramatically made

8:33

people's life better. But they didn't.

8:35

They have chosen to actually add to the

8:36

language ways in which make it so that

8:39

every code base is going to be so

8:41

bespoke now and so much different. It's

8:43

going to be so much more frustrating

8:46

than it used to be. Go is no longer the

8:48

language I like. I don't want to use Go

8:51

anymore. In fact, I kind of found its

8:53

spiritual successor. So, Odin right

8:56

here, the language that you see right

8:57

behind me, this thing I've actually

8:59

really enjoyed because it reminds me so

9:01

much of Go. It has package level or

9:03

directory level packages. So, everything

9:06

inside a directory now shares all the

9:07

types. I really prefer that over file

9:10

level modules. I like package level

9:12

modules or package level directories.

9:14

Oh, so much better. It also has explicit

9:17

overloading. I really, really liked it.

9:20

It does do some polymorphism, parametric

9:22

polymorphism, and all that. But

9:24

honestly, I rarely even feel like I need

9:26

that. I just program the problem and it

9:29

works. The language looks good. It gives

9:32

you complete control over allocations

9:34

and how memory works, and it's just so

9:37

straightforward, absolutely lovely to

9:39

work with. And that's because Odin knows

9:42

what it wants to be. It's an unabashed,

9:45

simple, C-like

9:48

programming language designed and geared

9:51

towards games and graphics and that kind

9:53

of nature. Go used to be the same thing.

9:56

It was a simple kind of system-level,

9:59

server-level language that was designed

10:01

to sit in this intersection instead of

10:03

being like complicated Java land, you'd

10:05

have something super simple. The build

10:07

tool, the formatting tool, the how you

10:10

run it, all into one. It was a

10:12

self-contained, self-packaged language

10:15

with a very minimal package management

10:17

system built into it such that you

10:19

didn't actually overrun your project.

10:21

Like it knew what it was. But now, for

10:24

the first time, I feel like Go is having

10:26

its spiritual crisis. It doesn't know

10:29

what it wants to be. Now, apparently, it

10:31

wants to be Rust. It wants to like Okay,

10:33

I guess we have C++ light now.

10:35

Fantastic. That's all I've ever wanted

10:37

in life, right? I just wanted another

10:39

thing in which I can have massive

10:41

abstractions and find myself tight

10:43

masturbating all day instead of actually

10:44

solving the problem at hand. Thanks, Go.

10:47

Anyways, I say all this because I'm just

10:48

getting all fired up because it's like

10:50

one of the languages that I found very

10:52

appealing due to how different it was

10:55

from everything else. Like I knew that

10:56

when I used it, I was solving a specific

10:58

problem, and it was like the best tool

11:01

for the job. Like it had this very nice

11:03

kind of one-to-one reach. And now, like

11:06

Odin, it feels like that, too. It's a

11:07

very It has this very defined purpose,

11:10

and I feel like I can just reach for it

11:12

when I need to solve a certain problem.

11:14

I don't feel that anymore with Go. And

11:15

it just makes me feel a little bit

11:17

funny. I don't know. I don't know. Well,

11:18

hey, you know, I'm supposed to do this

11:20

as a YouTuber. Yo, hey bro, hey. What's

11:22

your opinion on this? Honestly, I'll

11:24

read them. Lay me Lay me down some

11:26

opinions. Maybe smash that like button

11:28

and the subscribe or something like

11:29

that. I I asked for this in a long time,

11:31

okay? I haven't asked for this in over

11:33

130,000 subs. So, why don't you just do

11:34

it? For old times' sake, okay? Me and

11:37

you, we're going to feel good better

11:38

together. The name

11:40

is the Primagen.

Interactive Summary

The host discusses his complicated relationship with the Go programming language, highlighting its historical appeal as a simple, constraint-focused, and highly readable language. He expresses frustration over recent updates like generics and iterators, which he argues move Go away from its core identity, leading to increased code complexity and inconsistency across codebases. He concludes by presenting the Odin language as a 'spiritual successor' that maintains the simplicity and predictability that he feels Go has lost.

Suggested questions

3 ready-made prompts