Open-Source Development is Amazing!
Table of Contents
- Introduction
-
First Bad Issue
- How I tried to fix it?
- Help Each Other!
-
MatterMost
- Issue
- Purpose of The Issue
-
Back To CLI
- Issue Description
- What does it mean?
- Implementation
- Result
- Conclusion
Introduction
This blog post is about Release 0.3. I would like to start with a little introduction, explaining how hard was to find a good issue. For the last Release 0.2 I had spent all my time on huge JavaFX project, I wasn't satisfied at all, for the reason that I had to find and close two issues within days. This time I was almost caught by the same problem, but by the end I served it as good as I could. Let me walk you through the time-line.
First Bad Issue
At the beginning, I have found an issue, where I was supposed to move App Icon from Dock to Tray for macOS users. It sounds really simple. However, project is written in Go which I had never used before. If you are a reader that is familiar with my blogs, you definitely know how often I learn new programming-languages. Going forward, I decided to learn Go lang from scratch.
Let me quickly explain what's this project about. This is Simple, free and efficient ad-blocker and privacy guard for Windows, macOS and Linux.
systray - First Attempt
Fortunately, Go is really simple to learn, so let's proceed to my attempts moving the icon from Dock to Tray.
For the first attempt I tried to implement using systray library that is written in Objective-C. It helps manipulate the macOS system UI and move application from Dock to Tray. I've written the code, using documentation within 2 hours, was so happy. However, I've got an issue related to the other library called wails which helps implement UI also written in Objective-C. Eventually, building the project failed, for the reason that these two libraries conflict because they use the same namings. I had to move forward and try different library/method.
trayhost - Second Attempt
Basically, this library works the same way as systray, and I had the same issue.
Any other library to do this works the same way, so I was stacked.
How I tried to fix it?
I forked systray project and changed the naming that caused the conflict. Imported my fork, as Go allows to import directly using git-url.
Unfortunately, it didn't work at all...
You may check my fork and see the changes: Click me :D
Objective-C - Third Attempt
This time I tried to write my code, using Objective-C and Go lang. After some time, I came up with the solution, but I got this error:
r0 0x0 r1 0x0 r2 0x0 r3 0x0 r4 0x18fef62cb r5 0x16d28db00 r6 0x6e r7 0x0 r8 0x1e844b5b5be91e5a r9 0x1e844b5a36c1ee5a r10 0x200 r11 0xb r12 0x0 r13 0x1ff800 r14 0x7fb r15 0xd3c1205a r16 0x148 r17 0x202129928 r18 0x0 r19 0x6 r20 0x16d28f000 r21 0x1003 r22 0x16d28f0e0 r23 0x2 r24 0x0 r25 0x16d28ecc0 r26 0x1f9a37000 r27 0x828 r28 0x140001021c0 r29 0x16d28da70 lr 0x18ff3ac20 sp 0x16d28da50 pc 0x18ff02a60 fault 0x18ff02a60
The error message indicates that you are attempting to initialize an NSWindow instance outside the main thread, which is not allowed in macOS applications. It was a huge problem, as I couldn't do it in the main thread, for the reason the rest of functionality wouldn't work.
Conclusion of First Bad Issue
Maintainer and I had a small talk where I'd been explaining everything. Eventually, he agreed that is impossible to implement with current project structure... I didn't finish it, and don't have PR :c
Help Each Other!
Open-source community is brilliant because people tend to help each other. I had only a week to finish, so I asked my friend Theo for help. He sent me couple of the repos that he worked on, and I decided to work on them.
MatterMost
MatterMost is an open source platform for secure collaboration across the entire software development lifecycle. It's pretty popular platform and has tons of issues, huge documentation as for users as for developers. It wasn't hard to contribute to this project.
Issue
This time I have taken something that matches my current skill level, and I don't shoot my foot. It was simple issue found in early mentioned mattermost.
Purpose of The Issue
The purpose of that issue is to fix linter errors for one of the files. I set up the project, and started working on it.
First thing first, I had to run linter and see all the errors. I checked the lines where it occurred, and fixed them all pretty quickly. Eventually, opened a PR.
Back To CLI
I really liked working on CLI tools because it's fun to me. For the second PR I found a project called lumen. Lumen is an instant AI Git Commit message, Git changes summary from the CLI. I really enjoyed working on this project! Unfortunately, the don't have that many issues, but I was lucky enough to get assigned. In addition, this tool is written in Rust, so I had to refresh my knowledge.
Issue Description
I found an issue Add STDIN support for explain command.
What does it mean?
This tool has an option explain which is invoked this way:
lumen explain <sha>
This command explains everything about certain commit, what it changed and why. Example:
Pretty useful tool, huh?
My implementation should allow to add functionality to this command:
echo "HEAD" | lumen explain -
So it takes STDIN value from echo, in my example HEAD, and replaces - with that HEAD value.
Implementation
I realized how to implement it. Created condition to check if - instead of sha.
r0 0x0 r1 0x0 r2 0x0 r3 0x0 r4 0x18fef62cb r5 0x16d28db00 r6 0x6e r7 0x0 r8 0x1e844b5b5be91e5a r9 0x1e844b5a36c1ee5a r10 0x200 r11 0xb r12 0x0 r13 0x1ff800 r14 0x7fb r15 0xd3c1205a r16 0x148 r17 0x202129928 r18 0x0 r19 0x6 r20 0x16d28f000 r21 0x1003 r22 0x16d28f0e0 r23 0x2 r24 0x0 r25 0x16d28ecc0 r26 0x1f9a37000 r27 0x828 r28 0x140001021c0 r29 0x16d28da70 lr 0x18ff3ac20 sp 0x16d28da50 pc 0x18ff02a60 fault 0x18ff02a60
Result
After changing 5 files, I came up with the result:
Now it has two options:
lumen explain <sha>
and
echo "HEAD" | lumen explain -
Both of these options are working, my implementation added new functionality, and saved previously implemented! Here's my PR.
Conclusion
Last couple of weeks weren't simple, but was fun. I learnt new language Go. Connected with Open-Source community which helped me to find one of the repos that I contributed to!
The above is the detailed content of Open-Source Development is Amazing!. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Go language performs well in building efficient and scalable systems. Its advantages include: 1. High performance: compiled into machine code, fast running speed; 2. Concurrent programming: simplify multitasking through goroutines and channels; 3. Simplicity: concise syntax, reducing learning and maintenance costs; 4. Cross-platform: supports cross-platform compilation, easy deployment.

Golang is better than C in concurrency, while C is better than Golang in raw speed. 1) Golang achieves efficient concurrency through goroutine and channel, which is suitable for handling a large number of concurrent tasks. 2)C Through compiler optimization and standard library, it provides high performance close to hardware, suitable for applications that require extreme optimization.

Golang and Python each have their own advantages: Golang is suitable for high performance and concurrent programming, while Python is suitable for data science and web development. Golang is known for its concurrency model and efficient performance, while Python is known for its concise syntax and rich library ecosystem.

Golang and C each have their own advantages in performance competitions: 1) Golang is suitable for high concurrency and rapid development, and 2) C provides higher performance and fine-grained control. The selection should be based on project requirements and team technology stack.

Golang is better than Python in terms of performance and scalability. 1) Golang's compilation-type characteristics and efficient concurrency model make it perform well in high concurrency scenarios. 2) Python, as an interpreted language, executes slowly, but can optimize performance through tools such as Cython.

Goimpactsdevelopmentpositivelythroughspeed,efficiency,andsimplicity.1)Speed:Gocompilesquicklyandrunsefficiently,idealforlargeprojects.2)Efficiency:Itscomprehensivestandardlibraryreducesexternaldependencies,enhancingdevelopmentefficiency.3)Simplicity:

C is more suitable for scenarios where direct control of hardware resources and high performance optimization is required, while Golang is more suitable for scenarios where rapid development and high concurrency processing are required. 1.C's advantage lies in its close to hardware characteristics and high optimization capabilities, which are suitable for high-performance needs such as game development. 2.Golang's advantage lies in its concise syntax and natural concurrency support, which is suitable for high concurrency service development.

The performance differences between Golang and C are mainly reflected in memory management, compilation optimization and runtime efficiency. 1) Golang's garbage collection mechanism is convenient but may affect performance, 2) C's manual memory management and compiler optimization are more efficient in recursive computing.
