How to make a shortcode for my WP_Query Loop? [duplicate]

I´m doing this since last year and i´m getting the shortcodes working:

   function my_code() {
   ob_start();
   get_template_part('loop_logos');
   return ob_get_clean();   
} 
add_shortcode( 'logos', 'my_code' );

where get_template_part loads the file loop_logos.php and logos is the name shortcode [logos].

HINT

When I started to do this I used to name all equal to avoid mistakes, Ex:

function loop_logos() {
       ob_start();
       get_template_part('loop_logos');
       return ob_get_clean();   
    } 
    add_shortcode( 'loop_logos', 'loop_logos' );

So I had to worry about to upload the loop_logos.php on the right folder. and call the shortcode with [loop_logos]