Тёмный

justforfunc #19: mastering io.Pipes 

justforfunc: Programming in Go
Подписаться 40 тыс.
Просмотров 34 тыс.
50% 1

We've all used a bit of the io package ... right?
Implementations of io.Writer and io.Reader can be literally found everywhere ... but do you really know the io package well?
In this episode I write a program to do cat images into iTerm2, and to do that I use the best pieces of the io package.
I use four types in the io package:
golang.org/pkg...
golang.org/pkg...
golang.org/pkg...
golang.org/pkg...

Опубликовано:

 

11 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 47   
@JustForFunc
@JustForFunc 7 лет назад
It turns out I can't add links to the the video from this video ... which is sad, but if you wanted to skip the io.Pipe basics and go into the iterm2 imgcat program it's 11:45
@luizfelipemartino6804
@luizfelipemartino6804 7 лет назад
Hey Francesc, thank you for those videos man, I really like it. I'd like suggest you talk a bit about architecture, I know it's a bit subjective but We've got lots of design patterns and stuff for OO and since go has a sort of new paradigm would be nice to learn a bit more about it
@abiiranathan
@abiiranathan 2 года назад
Am your biggest fan. Your videos are very educational, fun and to the point. I wish you a million subs and beyond
@Ojee2
@Ojee2 7 лет назад
The intro made me smile :)
@vladimirbauer6604
@vladimirbauer6604 7 лет назад
Indeed, nice animation :)
@yann3658
@yann3658 7 лет назад
Nice video ! For this kind of complex things, maybe you can provide some visuals of what's in, what's out and interactions with pipes? Thank you, I really like your videos !
@silence1598
@silence1598 7 лет назад
Thank you for interesting introduction to io.Pipes.
@shamim520778774
@shamim520778774 6 лет назад
Your sessions are all mind blowing
@ucheumeh7357
@ucheumeh7357 4 года назад
Great tutorial on io.Pipes!!!
@LucasVieira42
@LucasVieira42 7 лет назад
This blew my mind \o/
@leonklingele
@leonklingele 7 лет назад
Where does the trailing % @ 8:58 come from? I've seen that one before but never really understood why it happens.
@leonklingele
@leonklingele 7 лет назад
Oh, nvm, it's because I was testing it in bash. The shell you're using - zsh - seems to automatically append a percent sign (%) to denote the end of a partial line (if it does not end in " "). unix.stackexchange.com/questions/167582/why-zsh-ends-a-line-with-a-highlighted-percent-symbol Guess I need to use zsh more often.
@saadazzz
@saadazzz 7 лет назад
Hey Francesc. Thanks for the instructional video. I have a question. How do you do async I/O in Go? All of these examples seem synchronous? Would I have to use channels instead of pipes?
@kitgary
@kitgary 7 лет назад
So cool! I made similar mistakes, I even don't know that is wrong.
@reddinghiphop1
@reddinghiphop1 5 лет назад
Thanks man !
@maksyko
@maksyko 7 лет назад
What about next lesson "end to end encryption golang chat messaner" ??
@AlbertoRestifo
@AlbertoRestifo 7 лет назад
Amazing and instructive as always Francisco! I have one question: in the imgcat package, you defined the `writer` struct as an unexported variable, despite the fact that is returned by an exported method. Why does this work?
@JustForFunc
@JustForFunc 7 лет назад
+Alberto Restifo first things first: my name is Francesc I define an exported type, but I return an exported interface (io.WriteCloser). You could technically return the unexported type too, but that's just a bad idea
@Shan-fx5wv
@Shan-fx5wv 3 года назад
How to create a named pipe and write a content to it?
@Shan-fx5wv
@Shan-fx5wv 3 года назад
Syscall.Mkfifo is not getting imported
@MagnusAndersson79
@MagnusAndersson79 7 лет назад
This should be called "how to write enterprise code"! "This is a working program, let's add go functions, channels and interfaces!" Still, you just earned a subscriber :D
@JustForFunc
@JustForFunc 7 лет назад
that's not really the point though it is a working program, but something that is hard to reuse in order to provide something that is easily pluggable (i.e. an io.Writer) you need to use pipes and goroutines
@MagnusAndersson79
@MagnusAndersson79 7 лет назад
Yeah, I know.. I just thought it was funny how complex you made something that would be a one-liner in bash.. (Not being negative here, just found it interesting and amusing) :)
@svenax
@svenax 7 лет назад
Sure, but would it be reusable and easily pluggable in bash?
@simonso3251
@simonso3251 7 лет назад
How would you do this in one line in bash?
@JustForFunc
@JustForFunc 7 лет назад
according to iTerm2 this is the equivalent bash, a bit more than one line :) raw.githubusercontent.com/gnachman/iTerm2/master/tests/imgcat
@BryanChance
@BryanChance Год назад
OMG, i thought C is convoluted. LOL And all the err err err err err. (I've never used Go before. just my first impression)At 36:55, line 64 "
@nbari8971
@nbari8971 7 лет назад
Hi Francesc, first at all, many thanks for all your time invested on this and by sharing knowledge in a very creative way. Regarding io.Pipes, I tried them for STDOUT & STDIN but had some problems with them, I used os.Pipe and that fixed my problem. Taking advantage of your expertise on the topic and if it's not too much to ask, could you please review the lines in question regarding this: github.com/immortal/immortal/blob/master/process.go#L74-L106 I would really appreciate any feedback, thanks in advance.
@vikramdurai2025
@vikramdurai2025 6 лет назад
11:02 laziest person I've ever seen. Why not just "mw.Write([]byte('hello'))"? Use what it has already man
@JustForFunc
@JustForFunc 6 лет назад
well, laziness is a feature of most good engineers ... so thanks!
@vikramdurai2025
@vikramdurai2025 6 лет назад
im also quite a lazy programmer, but just use the methods dude you don't need so many libraries
Далее
justforfunc #18: understanding Go's type aliases
38:58
justforfunc #22: using the Go execution tracer
35:55
Просмотров 21 тыс.
justforfunc #30: The Basics of Protocol Buffers
28:31
justforfunc #9: The Context Package
36:27
Просмотров 141 тыс.
err != nil Is GOOD? (And Why)
7:19
Просмотров 93 тыс.
ARRAYLIST VS LINKEDLIST
21:20
Просмотров 65 тыс.
Twelve Go Best Practices - Francesc Campoy
49:27
Просмотров 70 тыс.
The Tragedy of systemd
47:18
Просмотров 1,1 млн