Plagiarized programming assignment - How to proceed I'm a fourth year student earning a degree in computer science. I have a fairly high gpa, completed two research projects, and have conducted myself honestly through my entire career. A few weeks ago, we received an assignment comprised of 3 sections. My class partner and I decided to work separately on a single module and then collaborate on the last section. After a few days, my partner brought it to my attention that he had found the entire assignment on Github. This bothered me, but I ultimately made the decision to not back out if he decided to plagiarize his section. After completing both of our sections(I did mine honestly) we began collaboration on the final part. At this point, I made the regrettable decision to mimic a significant portion of the other programs structure.

I feel incredibly guilty about this. If this were an individual project, I would fess up to the professor and accept whatever consequences. However, since my partner(who I also consider a friend) is graduating, and starting a well paying job in a nearby city, I feel obliged to hope for the best and see things through.

I do not consider myself to be an unethical person, but high levels of stress and a bad influence caused me to make a bad decision. This I realize is my own fault.

We have not yet received a grade for the assignment, but I'm expecting the worst. How should I proceed? If I do get caught, what will the consequences be? If I don't get caught, is there anything I can do to relieve myself of guilt without ruining my partners career?
It's hard to judge whether your specific situation constitutes plagiarism, since copying "structure" has room for a gray area.

From what you've said though, I personally would take it to the professor.  As someone who has graded student coding work many times in the past, I can say I've definitely developed a feel for when code is copied, and it's usually very easy to check.  Every individual has a signature way of doing things that emerges when enough time is spent looking at their work.

Go in and say you intended to use it as a reference, but upon reflection without the looming deadline you feel like you overdid it, to the point of the work being too close to unoriginal.  Offer to redo it, but be prepared to accept whatever the professor says.  Personally, I can say I would be totally receptive to a student who owned up like that, but obviously there are no guarantees.

Unequivocally though, the worst-case scenario is that the professor figures it out on their own and agrees that it's plagiarism.  The fact that it's a previous student just ups the chances of that.  Plus your own gut is telling you you did something wrong, or you wouldn't be here asking us about it.

Good luck!

Edit: It's also worth consulting your syllabus.  It's possible there are explicit guidelines laid out for dealing with outside code that you should be very aware of before deciding and/or talking to your professor.