search
HomeBackend DevelopmentGolangOpen-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>
</sha>

This command explains everything about certain commit, what it changed and why. Example:

Open-Source Development is Amazing!

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:

Open-Source Development is Amazing!

Now it has two options:

lumen explain <sha>
</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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Go language pack import: What is the difference between underscore and without underscore?Go language pack import: What is the difference between underscore and without underscore?Mar 03, 2025 pm 05:17 PM

This article explains Go's package import mechanisms: named imports (e.g., import "fmt") and blank imports (e.g., import _ "fmt"). Named imports make package contents accessible, while blank imports only execute t

How to implement short-term information transfer between pages in the Beego framework?How to implement short-term information transfer between pages in the Beego framework?Mar 03, 2025 pm 05:22 PM

This article explains Beego's NewFlash() function for inter-page data transfer in web applications. It focuses on using NewFlash() to display temporary messages (success, error, warning) between controllers, leveraging the session mechanism. Limita

How to convert MySQL query result List into a custom structure slice in Go language?How to convert MySQL query result List into a custom structure slice in Go language?Mar 03, 2025 pm 05:18 PM

This article details efficient conversion of MySQL query results into Go struct slices. It emphasizes using database/sql's Scan method for optimal performance, avoiding manual parsing. Best practices for struct field mapping using db tags and robus

How can I define custom type constraints for generics in Go?How can I define custom type constraints for generics in Go?Mar 10, 2025 pm 03:20 PM

This article explores Go's custom type constraints for generics. It details how interfaces define minimum type requirements for generic functions, improving type safety and code reusability. The article also discusses limitations and best practices

How do I write mock objects and stubs for testing in Go?How do I write mock objects and stubs for testing in Go?Mar 10, 2025 pm 05:38 PM

This article demonstrates creating mocks and stubs in Go for unit testing. It emphasizes using interfaces, provides examples of mock implementations, and discusses best practices like keeping mocks focused and using assertion libraries. The articl

How to write files in Go language conveniently?How to write files in Go language conveniently?Mar 03, 2025 pm 05:15 PM

This article details efficient file writing in Go, comparing os.WriteFile (suitable for small files) with os.OpenFile and buffered writes (optimal for large files). It emphasizes robust error handling, using defer, and checking for specific errors.

How do you write unit tests in Go?How do you write unit tests in Go?Mar 21, 2025 pm 06:34 PM

The article discusses writing unit tests in Go, covering best practices, mocking techniques, and tools for efficient test management.

How can I use tracing tools to understand the execution flow of my Go applications?How can I use tracing tools to understand the execution flow of my Go applications?Mar 10, 2025 pm 05:36 PM

This article explores using tracing tools to analyze Go application execution flow. It discusses manual and automatic instrumentation techniques, comparing tools like Jaeger, Zipkin, and OpenTelemetry, and highlighting effective data visualization

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.