Тёмный
No video :(

justforfunc #15: a code review with logging, errors, and signals 

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

Back to code reviews!
This time I review a piece of code by / sandeepdinesh , from his repo github.com/the...
The program simply reads from standard input and sends each line both to standard output and a logging service.
What could go wrong? Many things!
References:
- cloud logging docs: cloud.google.c...
- original repo: github.com/the...
- source code: github.com/cam...

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

 

26 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 37   
@parnmatt
@parnmatt 7 лет назад
35:20 in a thread safe way ... with two concurrent inset videos 😁 nice intersting review, that's again. look forward to the next one.
@JustForFunc
@JustForFunc 7 лет назад
concurrency is hard!!!
@mhausenblas
@mhausenblas 7 лет назад
Congrats, awesome as usual! Also, very happy to learn you're increasing the frequency to twice a month and wish you all the best with it, especially that you can sustain it … I can imagine it costs a bit of time to prepare an episode. One suggestion/idea, since you'll have some room to fill: incorporate other Gophers. Something like peer programming or the like. Since we Gophers are gregarious animals, this aspect (how to code in a team, how to work together to achieve something) would be beneficial as well, methinks … KUTGW!
@sergiogalvan9404
@sergiogalvan9404 7 лет назад
As usual a great learning experience, thanks for the dedication you put on it.
@RandomShowerThoughts
@RandomShowerThoughts 4 года назад
Great video, makes you really notice the subtle differences in code
@paracha3
@paracha3 7 лет назад
Awesome video. This video taught me lot of little things which i can use in my day to day code. Thanks!
7 лет назад
Good stuff! One tips - you can run "echo $?" to print the last return value. More generic and perhaps easier to follow than the arrow in your custom prompt. :)
@HerbertFischer
@HerbertFischer 7 лет назад
That's tech diversity! You write Go (bootstrapped at Google) in an Apple computer, using a Microsoft editor! :D
@joseph13058
@joseph13058 5 лет назад
I love this video format
@AkimDemaille
@AkimDemaille 6 лет назад
FWIW, both `killall` and `pkill` allow to send a signal to a process selected by name. Killall wants a name equality and pkill does pattern matching. So here `killall -2 logpipe` (or `killall -INT logpipe`) would do. Both are available on MacOS.
@DreamhopMusic
@DreamhopMusic 7 лет назад
nice editing !! this must take quite a long time
@netsabrewulf
@netsabrewulf 7 лет назад
Thank you! Really cool videos. Keep going!
@devarsh099
@devarsh099 7 лет назад
I'm in love with your videos :D
@theyruinedyoutubeagain
@theyruinedyoutubeagain 7 лет назад
Certified lit
@steffenn6372
@steffenn6372 7 лет назад
Awesome video! More of this! 👍
@kianostad5064
@kianostad5064 7 лет назад
Thanks, Can you cover code generating (in deep) too?
@sivasai4192
@sivasai4192 6 лет назад
is there a way to define logging severity without using stackdriver logging client package. whenever i am using fmt.Println in my service all those statements i can see in stackdriver logs as INFO logs . Is there a way to do it?
@vsabreu
@vsabreu 7 лет назад
Francis, how do you have that different "not equal" sign in your editor? And the channel arrow is quite prettier also, is it an extension? If so, which one? BTW, your videos are amazing. Thanks!
@mikelee5691
@mikelee5691 7 лет назад
check his other videos. he gets asked this on this every video.
@vsabreu
@vsabreu 7 лет назад
Thanks a lot, Mike!
@MrSnack111
@MrSnack111 7 лет назад
Thank you very much!
@BouJebba
@BouJebba 7 лет назад
Thanks, really love your show. BTW Error numbers are actually standardised en.m.wikipedia.org/wiki/Errno.h Respecting the standard would allow a calling program (such as a shell script) to take a decision based on the error's value. Returning 2 everywhere is probably not a good idea ;)
@JustForFunc
@JustForFunc 7 лет назад
I imagined there would be such a standard ... but to be honest I've never seen anyone respecting it haha Do you know the standard well, what error codes would you returns?
@HowardCShawIII
@HowardCShawIII 7 лет назад
Just an FYI, the linked errno standard is actually for the C language static memory location 'errno' field. Not about exit values. /usr/include/sysexits.h is an attempted standard for exit codes. The missing parameter would be EX_USAGE (64). The missing input data could be EX_NOINPUT (66) or EX_DATAERR (65) , the failure to create the logging client might be EX_UNAVAILABLE (69), etc.
@josearmesto4059
@josearmesto4059 6 лет назад
Awesome video! Any reason to use fmt.Print() and os.Exit() instead of log.fatal? Thanks!
@JustForFunc
@JustForFunc 6 лет назад
I don't like the call stack on log.Fatal
@raunaksingwi4478
@raunaksingwi4478 5 лет назад
What plugins do you use with VScode for go lang development? I really like how your != symbol looks like, I would like to have that kind of symbols.
@ilyakopyl
@ilyakopyl 2 года назад
FiraCode typeface.
@JackTraynor14
@JackTraynor14 7 лет назад
Is the "break loop" pattern a good practice to follow? You could achieve the same thing using this pattern, which uses more standard syntax. loop := true for loop { if someErrorCase { loop = false } }
@JustForFunc
@JustForFunc 7 лет назад
+Jack Traynor I think break loop is easier to understand than using booleans Also, according to grep is quite idiomatic :)
@JackTraynor14
@JackTraynor14 7 лет назад
Fair enough. Thank you. :)
@Oswee
@Oswee 6 лет назад
Hi. I would like to see entire series of "Code review in depth for programming beginners" to fill up the gap after learning syntax and before ability to code some simple meaningful programms. I found that almost nobody teach how to solve tasks for beginners. For me it looks like every instructor expect that after learning syntax and basics noobies will be able to write calculators, tic tac toes, to dos and so on. No. As noobie i can tell.. no... i am not able to glue conditions, maps, interfaces, methods, constants together to get something working. I just dont know how to construct it. I dont know the logic. And reading someones code does give me nothing because i do not understand why that code is written exactly like it is. Why this is constant, why this is variable, why this is self invoked function, why there is used this method and why there is 2 functions instead of one and why there is used pointer and there an adress. To build that stupid ToDo ap i need to understand why this and that must be done before something else and why it must be done exacly by using these techiques. So... i think some kind of noobie friendly code review could help. Lets say... code review of registration and login system. Or code review of some CRUD system. From frontpage to backend and sql.
@Sanchellios
@Sanchellios 7 лет назад
Hello Francisc. How to overcome fear, that I'll never be hired as go-developer?
@MrTripi
@MrTripi 6 лет назад
Couldn't you just call log.Fatal?
@pablodados
@pablodados 7 лет назад
I don't know about go-flags, but the standard flag package will happily parse an empty string flag, e.g. logpipe --project= This would make ProjectID an empty string. Maybe this is why the check you remove at 11:54 was there?
@JustForFunc
@JustForFunc 7 лет назад
The package Sandeep used allows you to say that a flag is required, and `Parse` will fail in that case.
Далее
justforfunc #19: mastering io.Pipes
41:24
Просмотров 33 тыс.
Whoa
01:00
Просмотров 22 млн
SPONGEBOB POWER-UPS IN BRAWL STARS!!!
08:35
Просмотров 17 млн
Cute kitty gadgets 💛
00:24
Просмотров 12 млн
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
Просмотров 140 тыс.
Compilers, How They Work, And Writing Them From Scratch
23:53
Modern Python logging
21:32
Просмотров 179 тыс.
justforfunc #37: sync.Pool from the pool
27:11
Просмотров 17 тыс.
Whoa
01:00
Просмотров 22 млн